Skip to content
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

Polyfills being treeshaked as deadcode #63

Open
josetapadas opened this issue Sep 2, 2019 · 1 comment
Open

Polyfills being treeshaked as deadcode #63

josetapadas opened this issue Sep 2, 2019 · 1 comment

Comments

@josetapadas
Copy link

Hello,

So there is a big discussion about how self executing functions or side effects are being shaked off when, for example, you directly import one poly fill.

Imagine the following scenario:

App A includes a component from module M.

Module M imports one of your polyfills P.

When webpack compiles A, as your module has no sideEffects in package.json, it simply thinks that P is dead code.

(A nice discussion can be followed at : webpack/webpack#6571)

What do you think of adding sideEffects to this library package.json?

Thank you!

@stof
Copy link

stof commented Sep 27, 2019

Well, the sideEffects flag allows to opt-in for side-effect-free mode (or partial side-effect-free mode when specifying some paths rather than false). If we module does not declare it, it is the same than declaring sideEffects: true. So this is already working that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants