-
Notifications
You must be signed in to change notification settings - Fork 74
fix(package): specify side-effects in package.json #383
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
base: master
Are you sure you want to change the base?
fix(package): specify side-effects in package.json #383
Conversation
gulp/package-task.js
Outdated
const sideEffects = [ | ||
"./asynciterable/todomstream.mjs", | ||
"./asynciterable/todomstream.js" | ||
]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with this change, the prototype patching needs to be captured. We should probably make this recursively read and add all the files in src/add
, since prototype patching is their entire purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have adjusted the implementation to also dynamically add all files from src/add
here.
I just used glob
for this. Please let me know if that is good enough from the perspective of integrating with gulp.
Inspecting the Do you see anything missing in our treeshaking integration tests rollup configuration? |
687cca8
to
ae80690
Compare
This prevents bundlers from tree-shaking Web Streams API compatibility extensions. Closes ReactiveX#382
ae80690
to
d2a2586
Compare
@trxcllnt, I'm not sure if you ran this on my PR branch or on master, and I also don't see the full path to the file on the screenshot, to fully understand the concern. Running testsI've run the This affects Test with side-effect importI have created a new test locallly, import 'ix/asynciterable/todomstream';
import { AsyncIterableX } from 'ix/asynciterable';
console.log(AsyncIterableX.prototype.toDOMStream); As you can see, I added a side-effect import there: This seems to be related to the fact that the original test only uses the Test with the main entrypointSince the original test imports directly from import { AsyncIterable } from 'ix';
console.log(AsyncIterable.prototype.toDOMStream); This doesn't work either. Even if I explicitly add Test with explicit import of
|
I ran The generated import { toDOMStream } from 'ix/asynciterable';
console.log(toDOMStream); This seems to match your last test where the operator is imported and then used in a way where tree-shaking won't discard it. This is what I'd expect from tree-shaking -- it elides code that isn't directly imported and used. But from your description in #382, it sounds like you're importing This makes me wonder if we shouldn't move the |
Description:
This prevents bundlers from tree-shaking Web Streams API compatibility extensions.
Related issue (if exists):
#382