-
Notifications
You must be signed in to change notification settings - Fork 335
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
Add sideEffects flag #303
base: trunk
Are you sure you want to change the base?
Add sideEffects flag #303
Conversation
Please revert unnecessary changes before I can consider this. |
4176aac
to
b5f248d
Compare
Ready |
Thanks! Ok if I'm reading this correctly, all that would change is that it would enable Webpack to remove |
Yes, without this flag webpack will always include whole package to final bundle. |
From what I'm reading, this marks the whole module as side effect free, but it's not quite true. This does run on import with some module global state. Does this need to be cleaned up? Lines 169 to 181 in 15f4b93
|
ChatGPT says you are right :)
|
I'm up for doing that differently. It can be a fn call that caches a global so it's not a side effect. I would like to see what's actually necessary to make your change work. A quick example even with #208 applied doesn't seem to have any changes in the generated bundle. See https://github.com/zpao/qrcode.react/tree/sideEffects-test. |
Hmm IDK if If |
Hello! I need to add
sideEffects: false
for correct tree-shaking of Webpack (docs).