-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Mark all generated package.json files as "sideEffects": false. #8213
Mark all generated package.json files as "sideEffects": false. #8213
Conversation
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.
👍 thanks @benjamn!
Should fix #8168. The only side-effectful file we previously advertised was the fixPolyfills.native.js module within @apollo/client/cache, but that file should be used only in React Native, whose Metro bundler does not perform tree-shaking or dead code elimination. In other words, I believe we can get away with "sideEffects": false in all of our package.json files, for simplicity.
4a36514
to
31636dc
Compare
Hi! I'm not sure if this is normal or what in our setup is broken but I'm getting this error when building with Webpack when using that patch :
I tried adding the modules to the sideEffects field but no luck! |
What is |
@phbou72 As far as I can tell, that is a custom Shopify Webpack plugin? Can you provide more information? |
Thanks for giving feedback so fast guys. I've clarified the situation with the guys at Shopify and yeah like you said it was a plugin causing this. So it's all resolved now! Thanks! |
Should fix #8168 and #5686.
The only side-effectful file we previously advertised was the
fixPolyfills.native.js
module within@apollo/client/cache
, but that file should be used only in React Native, whose Metro bundler does not perform tree-shaking or dead code elimination, which means we never really needed to defend that file from tree-shaking in the first place. In other words, I believe we can get away with putting"sideEffects": false
in all of ourpackage.json
files, for simplicity (as correctly conjectured by @nwalters512 in #8168).Background explanation of the
"sideEffects": false
convention: https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free