Skip to content

Commit

Permalink
Partial revert of #8250 as this is no longer a limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Nov 5, 2018
1 parent b19337e commit 6e64480
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/ProvidePlugin.js
Expand Up @@ -66,8 +66,9 @@ class ProvidePlugin {
normalModuleFactory.hooks.parser
.for("javascript/dynamic")
.tap("ProvidePlugin", handler);

// Disable ProvidePlugin for javascript/esm, see https://github.com/webpack/webpack/issues/7032
normalModuleFactory.hooks.parser
.for("javascript/esm")
.tap("ProvidePlugin", handler);
}
);
}
Expand Down
1 change: 1 addition & 0 deletions test/configCases/plugins/provide-plugin/esm.js
@@ -0,0 +1 @@
module.exports = "esm";
4 changes: 2 additions & 2 deletions test/configCases/plugins/provide-plugin/foo.mjs
@@ -1,3 +1,3 @@
export default function foo() {
return typeof esm;
}
return esm;
}
2 changes: 1 addition & 1 deletion test/configCases/plugins/provide-plugin/index.js
Expand Up @@ -59,5 +59,5 @@ it("should provide ES2015 modules", function() {

it("should not provide for mjs", function(){
var foo = require("./foo.mjs").default;
expect(foo()).toBe("undefined");
expect(foo()).toBe("esm");
});
2 changes: 1 addition & 1 deletion test/configCases/plugins/provide-plugin/webpack.config.js
Expand Up @@ -11,7 +11,7 @@ module.exports = {
es2015_alias: ["./harmony", "alias"],
es2015_year: ["./harmony", "year"],
"this.aaa": "./aaa",
esm: "fail"
esm: "./esm"
})
]
};

0 comments on commit 6e64480

Please sign in to comment.