Skip to content

Commit 32c3ceb

Browse files
BenoitZugmeyershellscape
authored andcommitted
don't mutate stats configuration (#1174)
The webpack configuration `stats` property has the same format as the `devServer.stats` property, so the same object is frequently reused to define the same stats output. Since webpack v3.8.0, the `stats` property is validated more strictly by webpack. webpack-dev-server is mutating this `stats` object by adding a `colors` property, which is an object and doesn't match the webpack configuration schema, causing a fatal error. The easy fix is to *not* mutate the `stats` object, so webpack isn't breaking with a fatal error. But we may also consider setting a valid `colors` property.
1 parent ef18fc8 commit 32c3ceb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bin/webpack-dev-server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,9 @@ function processOptions(webpackOptions) {
296296
};
297297
}
298298

299-
if (typeof options.stats === 'object' && typeof options.stats.colors === 'undefined') { options.stats.colors = argv.color; }
299+
if (typeof options.stats === 'object' && typeof options.stats.colors === 'undefined') {
300+
options.stats = Object.assign({}, options.stats, { colors: argv.color });
301+
}
300302

301303
if (argv.lazy) { options.lazy = true; }
302304

0 commit comments

Comments
 (0)