Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14118 from webpack/bugfix/multiple-module-externals
fix null module externals
- Loading branch information
Showing
12 changed files
with
134 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import fs1 from "fs"; | ||
import fs2 from "module-fs"; | ||
import fsPromises1 from "fs-promises"; | ||
import fsPromises2 from "module-fs-promises"; | ||
import path1 from "path"; | ||
import path2 from "module-path"; | ||
|
||
it("should be possible to import multiple module externals", () => { | ||
expect(fs2).toBe(fs1); | ||
expect(path2).toBe(path1); | ||
expect(fsPromises2).toBe(fsPromises1); | ||
}); |
3 changes: 3 additions & 0 deletions
3
test/configCases/externals/concatenated-module/test.filter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = () => { | ||
return !process.version.startsWith("v10."); | ||
}; |
25 changes: 25 additions & 0 deletions
25
test/configCases/externals/concatenated-module/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** @type {(variant: boolean) => import("../../../../").Configuration} */ | ||
const config = o => ({ | ||
externals: { | ||
"module-fs": o ? "module fs" : "module fs/promises", | ||
fs: o ? "node-commonjs fs" : "node-commonjs fs/promises", | ||
"module-fs-promises": o ? ["module fs", "promises"] : "module fs/promises", | ||
"fs-promises": o | ||
? ["node-commonjs fs", "promises"] | ||
: "node-commonjs fs/promises", | ||
"module-path": "module path", | ||
path: "node-commonjs path" | ||
}, | ||
optimization: { | ||
concatenateModules: true, | ||
usedExports: true, | ||
providedExports: true, | ||
mangleExports: true | ||
}, | ||
target: "node14", | ||
experiments: { | ||
outputModule: true | ||
} | ||
}); | ||
|
||
module.exports = [config(false), config(true)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters