Skip to content

Commit 58773ad

Browse files
authored
Merge pull request webpack#7931 from webpack/bugfix/concatenated-star-export
fixes webpack#7930
2 parents 6f1f18f + a92c23e commit 58773ad

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

lib/optimize/ConcatenatedModule.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,9 +1447,9 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate {
14471447
if (!used) {
14481448
source.insert(
14491449
-1,
1450-
`/* unused concated harmony import ${dep.name} */\n`
1450+
`/* unused concated harmony import ${def.name} */\n`
14511451
);
1452-
return;
1452+
continue;
14531453
}
14541454
let finalName;
14551455
const strictFlag = dep.originModule.buildMeta.strictHarmonyModule
@@ -1466,9 +1466,11 @@ class HarmonyExportImportedSpecifierDependencyConcatenatedTemplate {
14661466
}_${exportData}${strictFlag}__`;
14671467
}
14681468
const exportsName = this.rootModule.exportsArgument;
1469-
const content = `/* concated harmony reexport */__webpack_require__.d(${exportsName}, ${JSON.stringify(
1470-
used
1471-
)}, function() { return ${finalName}; });\n`;
1469+
const content =
1470+
`/* concated harmony reexport ${def.name} */` +
1471+
`__webpack_require__.d(${exportsName}, ` +
1472+
`${JSON.stringify(used)}, ` +
1473+
`function() { return ${finalName}; });\n`;
14721474
source.insert(-1, content);
14731475
}
14741476
} else {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export var a = 1;
2+
3+
var value = 42;
4+
5+
export { value };
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { value } from "./module";
2+
3+
it("should export the correct value", () => {
4+
expect(value).toBe(42);
5+
});
6+
7+
// prevent scope hoisting
8+
if(Math.random() < -1) {
9+
console.log(module.id);
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./export";

0 commit comments

Comments
 (0)