GeezerVison is showing github.com — Merge pull request #8250 from Aladdin-ADD/patch-3 · webpack/webpack@355590e
File tree
Expand file treeCollapse file tree
Open diff view settings
test/configCases/plugins/provide-plugin
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/ProvidePlugin.js +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -76,9 +76,8 @@ class ProvidePlugin { |
76 | 76 | normalModuleFactory.hooks.parser |
77 | 77 | .for("javascript/dynamic") |
78 | 78 | .tap("ProvidePlugin", handler); |
79 | | - normalModuleFactory.hooks.parser |
80 | | - .for("javascript/esm") |
81 | | - .tap("ProvidePlugin", handler); |
| 79 | + |
| 80 | + // Disable ProvidePlugin for javascript/esm, see https://github.com/webpack/webpack/issues/7032 |
82 | 81 | } |
83 | 82 | ); |
84 | 83 | } |
|
Collapse file
Copy file name to clipboard +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +export default function foo() { |
| 2 | + return typeof esm; |
| 3 | +} |
Collapse file
Copy file name to clipboardExpand all lines: test/configCases/plugins/provide-plugin/index.js +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -56,3 +56,8 @@ it("should provide ES2015 modules", function() { |
56 | 56 | expect((es2015_alias)).toBe("ECMAScript Harmony"); |
57 | 57 | expect((es2015_year)).toBe(2015); |
58 | 58 | }); |
| 59 | + |
| 60 | +it("should not provide for mjs", function(){ |
| 61 | + var foo = require("./foo.mjs").default; |
| 62 | + expect(foo()).toBe("undefined"); |
| 63 | +}); |
Collapse file
Copy file name to clipboardExpand all lines: test/configCases/plugins/provide-plugin/webpack.config.js +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,8 @@ module.exports = { |
10 | 10 | es2015_name: ["./harmony", "default"], |
11 | 11 | es2015_alias: ["./harmony", "alias"], |
12 | 12 | es2015_year: ["./harmony", "year"], |
13 | | - "this.aaa": "./aaa" |
| 13 | + "this.aaa": "./aaa", |
| 14 | + esm: "fail" |
14 | 15 | }) |
15 | 16 | ] |
16 | 17 | }; |