mirror of https://github.com/webpack/webpack.git
chore: throw error when dllplugin needs to generate multiple manifest files but the path config is incorrect.
This commit is contained in:
parent
e4fee1527b
commit
6b6ce2a4a8
|
|
@ -53,6 +53,8 @@ class LibManifestPlugin {
|
|||
},
|
||||
(compilation, callback) => {
|
||||
const moduleGraph = compilation.moduleGraph;
|
||||
// store used paths to detect issue and output an error. #18200
|
||||
const usedPaths = new Set();
|
||||
asyncLib.forEach(
|
||||
Array.from(compilation.chunks),
|
||||
(chunk, callback) => {
|
||||
|
|
@ -64,6 +66,11 @@ class LibManifestPlugin {
|
|||
const targetPath = compilation.getPath(this.options.path, {
|
||||
chunk
|
||||
});
|
||||
if (usedPaths.has(targetPath)) {
|
||||
callback(new Error(`each chunk must have a unique path`));
|
||||
return;
|
||||
}
|
||||
usedPaths.add(targetPath);
|
||||
const name =
|
||||
this.options.name &&
|
||||
compilation.getPath(this.options.name, {
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
module.exports = "a";
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = "b";
|
||||
|
|
@ -0,0 +1 @@
|
|||
module.exports = [[/each chunk must have a unique path/]];
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
var path = require("path");
|
||||
var webpack = require("../../../../");
|
||||
|
||||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
entry: {
|
||||
a: "./a",
|
||||
b: "./b"
|
||||
},
|
||||
output: {
|
||||
filename: "MyDll.[name].js",
|
||||
library: "[name]_[fullhash]"
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DllPlugin({
|
||||
path: path.resolve(
|
||||
__dirname,
|
||||
"../../../js/config/dll-plugin/manifest_without_string_template.json"
|
||||
)
|
||||
})
|
||||
]
|
||||
};
|
||||
Loading…
Reference in New Issue