Skip to content

Commit 1d35f36

Browse files
authored
Merge pull request webpack#6950 from mohsen1/set-concat
Use add() to append items to activeExports set in HarmonyExportImporedSpecifierDependency
2 parents 71d27d6 + 47354dd commit 1d35f36

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

lib/dependencies/HarmonyExportImportedSpecifierDependency.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,10 @@ HarmonyExportImportedSpecifierDependency.Template = class HarmonyExportImportedS
550550

551551
// Filter out exports which are defined by other exports
552552
// and filter out default export because it cannot be reexported with *
553-
if (activeExports.length > 0)
553+
if (activeExports.size > 0)
554554
content +=
555555
"if(" +
556-
JSON.stringify(activeExports.concat("default")) +
556+
JSON.stringify(Array.from(activeExports).concat("default")) +
557557
".indexOf(__WEBPACK_IMPORT_KEY__) < 0) ";
558558
else content += "if(__WEBPACK_IMPORT_KEY__ !== 'default') ";
559559
const exportsName = dep.originModule.exportsArgument;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export var x = 1;
2+
export * from "./cjs";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { x: 2, y: 3 };
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"use strict";
2+
3+
import {x, y} from "./a";
4+
5+
it("namespace export as from commonjs should override named export", function() {
6+
x.should.be.eql(1);
7+
y.should.be.eql(3);
8+
});

0 commit comments

Comments
 (0)