We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9487ee5 commit d28f9f5Copy full SHA for d28f9f5
1 file changed
bin/utils/convert-argv.js
@@ -5,7 +5,6 @@ const interpret = require("interpret");
5
const prepareOptions = require("./prepareOptions");
6
const webpackConfigurationSchema = require("../config/webpackConfigurationSchema.json");
7
const validateSchema = require("webpack").validateSchema;
8
-const WebpackOptionsValidationError = require("webpack").WebpackOptionsValidationError;
9
const findup = require("findup-sync");
10
11
module.exports = function(...args) {
@@ -137,11 +136,20 @@ module.exports = function(...args) {
137
136
138
function processConfiguredOptions(options) {
139
if (options) {
140
- const webpackConfigurationValidationErrors = validateSchema(webpackConfigurationSchema, options);
141
- if (webpackConfigurationValidationErrors.length) {
142
- const error = new WebpackOptionsValidationError(webpackConfigurationValidationErrors);
143
- console.error(error.message, `\nReceived: ${typeof options} : ${JSON.stringify(options, null, 2)}`);
144
- process.exit(-1); // eslint-disable-line
+ let error;
+ try {
+ const errors = validateSchema(webpackConfigurationSchema, options);
+ if (errors && errors.length > 0) {
+ const { WebpackOptionsValidationError } = require("webpack");
+ error = new WebpackOptionsValidationError(errors);
145
+ }
146
+ } catch (err) {
147
+ error = err;
148
149
+
150
+ if (error) {
151
+ console.error(error.message);
152
+ process.exit(-1);
153
}
154
} else {
155
options = {};
0 commit comments