Closed
Description
- Operating System: OS X
- Node Version: 8.6
- NPM Version: 5.4.2
- webpack Version: 2.5.1
- webpack-dev-server Version: 2.9.1
- This is a bug
- This is a feature request
- This is a modification request
Code
let server;
const devServerConfig = {};
const startServer = () => {
if (server) { server.close(); }
// webpack plugin code, calls `startServer` on error
server = new WebpackDevServer(compiler, devServerConfig);
server.listen(8080);
};
startServer();
// Server.js, line 33. this is the thrown error
const validationErrors = webpack.validateSchema(optionsSchema, options);
if (validationErrors.length) {
throw new OptionsValidationError(validationErrors);
}
Expected Behavior
- When I start a
webpack-dev-server
, it should validate the options passed through correctly. - When I start a new
webpack-dev-server
, it should validate the options passed through correctly.
Actual Behavior
- When I start a
webpack-dev-server
for the first time, thedevServerConfig
is mutated with a bunch of extra fields populated by the dev server itself. - When I try to start a new
webpack-dev-server
, the config object does not pass validation on line33
ofServer.js
because it mutated the config object.
For Bugs; How can we reproduce the behavior?
See the code snippets.