mirror of https://github.com/webpack/webpack.git
Merge pull request #9306 from jamesgeorge007/hotfix/refactor
Handle cryptic error message being thrown
This commit is contained in:
commit
494e16bd8d
|
|
@ -32,7 +32,9 @@ const webpack = (options, callback) => {
|
||||||
}
|
}
|
||||||
let compiler;
|
let compiler;
|
||||||
if (Array.isArray(options)) {
|
if (Array.isArray(options)) {
|
||||||
compiler = new MultiCompiler(options.map(options => webpack(options)));
|
compiler = new MultiCompiler(
|
||||||
|
Array.from(options).map(options => webpack(options))
|
||||||
|
);
|
||||||
} else if (typeof options === "object") {
|
} else if (typeof options === "object") {
|
||||||
options = new WebpackOptionsDefaulter().process(options);
|
options = new WebpackOptionsDefaulter().process(options);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -404,6 +404,25 @@ describe("Validation", () => {
|
||||||
- configuration.mode should be one of these:
|
- configuration.mode should be one of these:
|
||||||
\\"development\\" | \\"production\\" | \\"none\\"
|
\\"development\\" | \\"production\\" | \\"none\\"
|
||||||
-> Enable production optimizations or development hints."
|
-> Enable production optimizations or development hints."
|
||||||
|
`)
|
||||||
|
);
|
||||||
|
|
||||||
|
createTestCase(
|
||||||
|
"holey array",
|
||||||
|
// eslint-disable-next-line no-sparse-arrays
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode: "production"
|
||||||
|
},
|
||||||
|
,
|
||||||
|
{
|
||||||
|
mode: "development"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
msg =>
|
||||||
|
expect(msg).toMatchInlineSnapshot(`
|
||||||
|
"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
|
||||||
|
- configuration should be an object."
|
||||||
`)
|
`)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue