Reconsider - sideEffects: false
Andarist opened this issue · 5 comments
Im not sure about exact algo of how it works just yet, but I suspect that this field is unsafe at the moment because, while main entry has no side effects and this package.json field can be used safely for it, the other entries such as fantasy-land are actually effectful and might be dropped because of that.
I can check with webpack@4-beta later how it behaves.
Yes, you're right. That is a problem. As far as I've understood the value of sideEffects
can be an array of filenames. Then the files in the array are assumed to have side-effects and any file not in the array is assumed to be pure.
There is documentation for sideEffects
here. But it doesn't mention using an array 😕
I think more complex rules for this are considered an enhancement that is going to be implemented later, not sure though.
Ok. That is good to know. I was under the impression that it was already implemented.
It think there are two options:
- If Webpack 4 supports specifying specific files as having side effects then we do that.
- If Webpack 4 only supports a single global binary then people who import
list/fantasy-land
must also use some function from the module.
I don't think setting sideEffects
to true
because of the Fantasy Land module is desirable. It would hurt tree-shaking for the entire library.