You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
604 B
22 lines
604 B
4 years ago
|
const webpackConfigurationSchema = require("../config/webpackConfigurationSchema.json");
|
||
|
const validateSchema = require("webpack").validateSchema;
|
||
|
|
||
|
module.exports = function validateOptions(options) {
|
||
|
let error;
|
||
|
try {
|
||
|
const errors = validateSchema(webpackConfigurationSchema, options);
|
||
|
if (errors && errors.length > 0) {
|
||
|
const { WebpackOptionsValidationError } = require("webpack");
|
||
|
error = new WebpackOptionsValidationError(errors);
|
||
|
}
|
||
|
} catch (err) {
|
||
|
error = err;
|
||
|
}
|
||
|
|
||
|
if (error) {
|
||
|
console.error(error.message);
|
||
|
// eslint-disable-next-line no-process-exit
|
||
|
process.exit(-1);
|
||
|
}
|
||
|
};
|