You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
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:
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.jsdo have side effects, and all other files do not have side effects. However, the test asserts exactly the opposite:
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.
The text was updated successfully, but these errors were encountered:
mikeharder
changed the title
sideEffects array is processed incorrectly
sideEffects array is treated as exclusion list instead of inclusion list
Jun 20, 2019
mikeharder
changed the title
sideEffects array is treated as exclusion list instead of inclusion list
sideEffects array is treated as exclusion list
Jun 20, 2019
mikeharder
added a commit
to mikeharder/rollup-plugin-node-resolve
that referenced
this issue
Jun 20, 2019
* Treat sideEffects array as inclusion list
- Fixes#226
* Rename 'true-index' to 'array-index' for clarity
* Inline unnecessary local variable
* Rename test files from "-free" to "-effect"
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
How Do We Reproduce?
I believe the
sideEffects
array inpackage.json
is being treated as an exclusion list instead of an inclusion list. The current code setshasModuleSideEffects
totrue
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:
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 testpackage.json
specifies the following filter:rollup-plugin-node-resolve/test/node_modules/side-effects-array/package.json
Lines 3 to 6 in fe7ea0e
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 havehasModuleSideEffects
set to a function which returnstrue
.Actual Behavior
Files matching the
sideEffects
array havehasModuleSideEffects
set to a function which returnsfalse
.The text was updated successfully, but these errors were encountered: