Invalid options object. Dev Server has been initialized using an options object

4,290 阅读1分钟

按照官网就是显示的做的contentBase报错。。。。。。。

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

  • options has an unknown property 'contentBase'. 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?, setupExitSignals?, static?, watchFiles?, webSocketServer? }

    解决方法:

    devServer:{
         static:'./dist',
         // contentBase: path.join(__dirname, "dist"),
         open: true,
     },