Skip to content

Commit

Permalink
Treat sideEffects array as inclusion list
Browse files Browse the repository at this point in the history
- Fixes rollup#226
  • Loading branch information
mikeharder committed Jun 20, 2019
1 parent cdb7448 commit 91107fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default function nodeResolve ( options = {} ) {
packageInfo.hasModuleSideEffects = () => packageSideEffects;
} else if (Array.isArray(packageSideEffects)) {
const filter = createFilter(packageSideEffects, null, {resolve: pkgRoot});
packageInfo.hasModuleSideEffects = id => !filter(id);
packageInfo.hasModuleSideEffects = id => filter(id);
}

packageInfoCache.set(pkgPath, packageInfo);
Expand Down
1 change: 1 addition & 0 deletions test/node_modules/side-effects-array/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,9 @@ describe( 'rollup-plugin-node-resolve', function () {
'true-dep1',
'true-dep2',
'true-index',
'array-dep2',
'array-dep4',
'array-dep1',
'array-dep3',
'array-dep5',
'true-index'
]);
delete global.sideEffects;
Expand Down

0 comments on commit 91107fe

Please sign in to comment.