Skip to content

Commit

Permalink
fixes #8666
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jan 22, 2019
1 parent 25bccd4 commit 42007e8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/optimize/ConcatenatedModule.js
Expand Up @@ -1096,7 +1096,7 @@ class ConcatenatedModule extends Module {

// add harmony compatibility flag (must be first because of possible circular dependencies)
const usedExports = this.rootModule.usedExports;
if (usedExports === true) {
if (usedExports === true || usedExports === null) {
result.add(
runtimeTemplate.defineEsModuleFlagStatement({
exportsArgument: this.exportsArgument
Expand Down
6 changes: 6 additions & 0 deletions test/cases/scope-hoisting/esModule/index.js
@@ -0,0 +1,6 @@
it("should have the __esModule flag", () => {
return import("./module").then(mod => {
expect(mod.__esModule).toBe(true);
expect(mod.default).toBe(84);
})
})
3 changes: 3 additions & 0 deletions test/cases/scope-hoisting/esModule/module.js
@@ -0,0 +1,3 @@
import other from "./other";

export default other * 2;
1 change: 1 addition & 0 deletions test/cases/scope-hoisting/esModule/other.js
@@ -0,0 +1 @@
export default 42;
6 changes: 6 additions & 0 deletions test/configCases/scope-hoisting/esModule/index.js
@@ -0,0 +1,6 @@
it("should have the __esModule flag", () => {
return import("./module").then(mod => {
expect(mod.__esModule).toBe(true);
expect(mod.default).toBe(84);
})
})
3 changes: 3 additions & 0 deletions test/configCases/scope-hoisting/esModule/module.js
@@ -0,0 +1,3 @@
import other from "./other";

export default other * 2;
1 change: 1 addition & 0 deletions test/configCases/scope-hoisting/esModule/other.js
@@ -0,0 +1 @@
export default 42;
7 changes: 7 additions & 0 deletions test/configCases/scope-hoisting/esModule/webpack.config.js
@@ -0,0 +1,7 @@
module.exports = {
mode: "development",
devtool: false,
optimization: {
concatenateModules: true
}
};

0 comments on commit 42007e8

Please sign in to comment.