sideEffects array is treated as exclusion list
mikeharder opened this issue · 0 comments
- Node-Resolve Plugin Version: 5.0.3
- Rollup Version: 1.15.6
- Operating System (or Browser): Windows 10
- Node Version: 10.16.0
How Do We Reproduce?
I believe the sideEffects
array in package.json
is being treated as an exclusion list instead of an inclusion list. The current code sets hasModuleSideEffects
to true
if the id does not match the filter specified by the array:
rollup-plugin-node-resolve/src/index.js
Line 149 in fe7ea0e
However, I believe this is backwards, and the correct code should be:
packageInfo.hasModuleSideEffects = id => filter(id);
The pull request which added this feature (#219) includes tests for the sideEffects
array, but I believe the expected test results are backwards as well. The test package.json
specifies the following filter:
Which should mean that dep1.js
and *-free.js
do have side effects, and all other files do not have side effects. However, the test asserts exactly the opposite:
rollup-plugin-node-resolve/test/test.js
Lines 875 to 876 in fe7ea0e
Expected Behavior
Files matching the sideEffects
array should have hasModuleSideEffects
set to a function which returns true
.
Actual Behavior
Files matching the sideEffects
array have hasModuleSideEffects
set to a function which returns false
.