Webpack@5.66.0 Webpack dev server config: options has an unknown property 'stats'

Viewed 2609

Invalid options object. Dev server has been initialized using an options object that does not match the API schema.

  • optionshas an unknown property 'stats'. These properties are valid: object { allowedHost?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, setupMiddlewares?, static?, watchFiles?, webSocketServer? }

webpack.dev.server.js

module.exports = function getDevServerConfig(options) {
...
...
const devServer = {
...
...
disableHostCheck: true,
noInfo: false,
stats: {
assets: true,
color: true
}

}

}```
2 Answers

I was able to fix this issue by deleting node_modules and yarn.lock. After that I ran yarn to rebuild node_modules and then yarn start worked without an issue.

Related