-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some operators e.g. rxjs/operator/multicast pulls in code for *all* operators now #2812
Comments
Using this harness with a non-tree-shaking, CommonJS bundler: const { Observable } = require("rxjs/Observable");
require("rxjs/add/operator/map"); When bundling When bundling If, in import { map as higherOrder } from '../operators/map'; The resultant bundle size would be 42,638 bytes. |
@cartant good catch, you're right! The problem is inverted: it's not the lettable operators which pull in the others, it's the older operator files that pull in all the lettables, as they defer their implementation to the lettable forms but do not specifically import only what they need |
Ensures users won't run into ReactiveX#2812
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
It looks like now that the older operator files import the lettable operators, they (unintentionally?) import all operators.
rxjs/src/operator/multicast.ts
Line 4 in de9f2c8
rxjs/src/operator/buffer.ts
Line 3 in de9f2c8
rxjs/src/operators/index.ts
Lines 1 to 59 in de9f2c8
I also see this pattern is used in some pending PRs too
I've been out of the loop, so it's entirely possible I'm confused or there is some magic that prevents it from being a problem--without requiring people use treeshaking. Or maybe that's the plan?
The text was updated successfully, but these errors were encountered: