Merge pull request #8667 from webpack/bugfix/esModule-flag

fixes #8666
This commit is contained in:
Tobias Koppers 2019-01-22 10:06:34 +01:00 committed by GitHub
commit a0eab48f37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 1 deletions

View File

@ -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

View File

@ -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);
})
})

View File

@ -0,0 +1,3 @@
import other from "./other";
export default other * 2;

View File

@ -0,0 +1 @@
export default 42;

View File

@ -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);
})
})

View File

@ -0,0 +1,3 @@
import other from "./other";
export default other * 2;

View File

@ -0,0 +1 @@
export default 42;

View File

@ -0,0 +1,7 @@
module.exports = {
mode: "development",
devtool: false,
optimization: {
concatenateModules: true
}
};