Clarify tree shaking explanation from the docs #18821
Unanswered
yishay-at-bay
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Please open an issue in the documentation repository and we will improve this. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The docs has a very detailed explanation about tree shaking and the sideEffects flag in package json
But not all of it is clear to me, especially this part
Can someone please clarify the Shopify example or give similar example with more details about what code exists on each file and how the tree shaking logic works?
Also, can someone give an example of a npm package that includes some code that has side effects (for example, some module
setWindowProp.js
that is setting some property on the global window object) and then if you setsideEffect: false
in this package will cause consuming apps to skip that code, and if you setsideEffects: ["setWindowProp.js"]
it will cause the consuming app to include that code in the app's bundle even if it is not imported directlyThank you
Beta Was this translation helpful? Give feedback.
All reactions