Webpack dev server does not recognize watchContentBase as a valid option. Is watchContentBase deprecated? If so what is the alternative? Below is the configuration of my Webpack dev server:
devServer: {
contentBase: path.resolve(__dirname, 'dist'),
port: 8080,
open: true,
hot: true,
watchContentBase: true,
}
When I run my server, I get the following error.
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property 'watchContentBase'. These properties are valid: object { allowedHosts?, bonjour?, client?, compress?, devMiddleware?, headers?, historyApiFallback?, host?, hot?, http2?, https?, ipc?, liveReload?, magicHtml?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, port?, proxy?, server?, setupExitSignals?, static?, watchFiles?, webSocketServer? }
In the newer version, contentBase has been replaced with static
devServer:{
static: path.resolve(__dirname, 'src'),
port: 8080,
open: true,
hot: true
}
Just rename contentBase to static.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With