Home > Enterprise >  Webpack dev server does not recognize watchContentBase as valid option
Webpack dev server does not recognize watchContentBase as valid option

Time:11-24

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? }

CodePudding user response:

Just rename contentBase to static.

CodePudding user response:

contentBase/contentBasePublicPath/serveIndex/watchContentBase/watchOptions/staticOptions options were moved to static option in [email protected]. and they are no longer available.

For more details please read the migration guide at https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md

  • Related