Skip to content

Commit

Permalink
Merge pull request #10146 from liximomo/fix-sideEffects
Browse files Browse the repository at this point in the history
fix: bundle wrong modules
  • Loading branch information
sokra committed Dec 18, 2019
2 parents 5b8fbca + 1452d19 commit ab4fa8d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/optimize/SideEffectsFlagPlugin.js
Expand Up @@ -115,7 +115,7 @@ class SideEffectsFlagPlugin {
(dep instanceof HarmonyImportSpecifierDependency &&
!dep.namespaceObjectAsContext)
) {
const mapping = map.get(dep.id);
const mapping = map.get(dep._id);
if (mapping) {
dep.redirectedModule = mapping.module;
dep.redirectedId = mapping.exportName;
Expand Down
5 changes: 5 additions & 0 deletions test/cases/side-effects/wrong-module-10146/index.js
@@ -0,0 +1,5 @@
import { A } from "./module";

it("should return the correct module", () => {
expect(A()).toEqual("A/index.js");
});
3 changes: 3 additions & 0 deletions test/cases/side-effects/wrong-module-10146/module/A/A.js
@@ -0,0 +1,3 @@
export default function hello() {
return 'A/A.js'
}
6 changes: 6 additions & 0 deletions test/cases/side-effects/wrong-module-10146/module/A/index.js
@@ -0,0 +1,6 @@

export { default as A } from "./A";

export default function hello() {
return 'A/index.js'
}
1 change: 1 addition & 0 deletions test/cases/side-effects/wrong-module-10146/module/index.js
@@ -0,0 +1 @@
export { default as A } from "./A";
@@ -0,0 +1,3 @@
{
"sideEffects": false
}

0 comments on commit ab4fa8d

Please sign in to comment.