Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(package): migrate to schema-utils (dependencies) #1464

Merged
merged 1 commit into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions bin/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ function startDevServer(config, options) {
try {
server = new Server(compiler, options, log);
} catch (err) {
const OptionsValidationError = require('../lib/OptionsValidationError');

if (err instanceof OptionsValidationError) {
if (err.name === 'ValidationError') {
log.error(colors.error(options.stats.colors, err.message));
// eslint-disable-next-line no-process-exit
process.exit(1);
Expand Down
152 changes: 0 additions & 152 deletions lib/OptionsValidationError.js

This file was deleted.

9 changes: 3 additions & 6 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const webpackDevMiddleware = require('webpack-dev-middleware');
const createLogger = require('./utils/createLogger');
const createCertificate = require('./utils/createCertificate');

const OptionsValidationError = require('./OptionsValidationError');
const optionsSchema = require('./optionsSchema.json');
const validateOptions = require('schema-utils');
const schema = require('./options.json');

const STATS = {
all: false,
Expand All @@ -51,10 +51,7 @@ const STATS = {
function Server (compiler, options = {}, _log) {
this.log = _log || createLogger(options);

const validationErrors = webpack.validateSchema(optionsSchema, options);
if (validationErrors.length) {
throw new OptionsValidationError(validationErrors);
}
validateOptions(schema, options, 'webpack Dev Server');

if (options.lazy && !options.filename) {
throw new Error("'filename' option must be set in lazy mode.");
Expand Down
Loading