Skip to content

Commit

Permalink
Merge pull request #1024 from webpack/fix/no-config-mode
Browse files Browse the repository at this point in the history
fix: resolve opts when no-config & fix vulns
  • Loading branch information
evenstensberg authored Aug 18, 2019
2 parents a56e916 + 45b9127 commit b20ecd3
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 173 deletions.
16 changes: 10 additions & 6 deletions bin/utils/convert-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,23 @@ module.exports = function(...args) {
}

if (!configFileLoaded) {
return processConfiguredOptions({});
return processConfiguredOptions();
} else if (options.length === 1) {
return processConfiguredOptions(options[0]);
} else {
return processConfiguredOptions(options);
}

function processConfiguredOptions(options) {
const webpackConfigurationValidationErrors = validateSchema(webpackConfigurationSchema, options);
if (webpackConfigurationValidationErrors.length) {
const error = new WebpackOptionsValidationError(webpackConfigurationValidationErrors);
console.error(error.message, `\nReceived: ${typeof options} : ${JSON.stringify(options, null, 2)}`);
process.exit(-1); // eslint-disable-line
if (options) {
const webpackConfigurationValidationErrors = validateSchema(webpackConfigurationSchema, options);
if (webpackConfigurationValidationErrors.length) {
const error = new WebpackOptionsValidationError(webpackConfigurationValidationErrors);
console.error(error.message, `\nReceived: ${typeof options} : ${JSON.stringify(options, null, 2)}`);
process.exit(-1); // eslint-disable-line
}
} else {
options = {};
}

// process Promise
Expand Down
Loading

0 comments on commit b20ecd3

Please sign in to comment.