mirror of https://github.com/webpack/webpack.git
catch errors thrown during parser/generation creation
This commit is contained in:
parent
e9de77aae4
commit
eea0aee1a7
|
|
@ -520,6 +520,7 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
)
|
||||
);
|
||||
}
|
||||
try {
|
||||
Object.assign(data.createData, {
|
||||
layer:
|
||||
layer === undefined ? contextInfo.issuerLayer || null : layer,
|
||||
|
|
@ -543,6 +544,9 @@ class NormalModuleFactory extends ModuleFactory {
|
|||
generatorOptions: settings.generator,
|
||||
resolveOptions
|
||||
});
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
this.resolveRequestArray(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
module.exports = [
|
||||
[
|
||||
/Invalid generator object\. Asset Modules Plugin has been initialized using a generator object that does not match the API schema/,
|
||||
/generator has an unknown property 'filename'/
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1 @@
|
|||
import url from "./text.txt";
|
||||
|
|
@ -0,0 +1 @@
|
|||
Hello World
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/** @type {import("../../../../").Configuration} */
|
||||
module.exports = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.txt$/,
|
||||
type: "asset/inline",
|
||||
generator: {
|
||||
filename: "[name].txt"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue