| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9487ee5 commit d28f9f5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,7 +5,6 @@ const interpret = require("interpret"); | |||
| 5 | 5 | const prepareOptions = require("./prepareOptions"); | |
| 6 | 6 | const webpackConfigurationSchema = require("../config/webpackConfigurationSchema.json"); | |
| 7 | 7 | const validateSchema = require("webpack").validateSchema; | |
| 8 | - const WebpackOptionsValidationError = require("webpack").WebpackOptionsValidationError; | ||
| 9 | 8 | const findup = require("findup-sync"); | |
| 10 | 9 | ||
| 11 | 10 | module.exports = function(...args) { | |
@@ -137,11 +136,20 @@ module.exports = function(...args) { | |||
| 137 | 136 | ||
| 138 | 137 | function processConfiguredOptions(options) { | |
| 139 | 138 | 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 | ||
| 139 | + let error; | ||
| 140 | + try { | ||
| 141 | + const errors = validateSchema(webpackConfigurationSchema, options); | ||
| 142 | + if (errors && errors.length > 0) { | ||
| 143 | + const { WebpackOptionsValidationError } = require("webpack"); | ||
| 144 | + 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); | ||
| 145 | 153 | } | |
| 146 | 154 | } else { | |
| 147 | 155 | options = {}; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments