执行命令:npx webpack-dev-server
报错:Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property 'comtentBase'. 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:{
//项目构建后的路径
comtentBase:resolve(__dirname,'build'),
//启动gzip压缩
compress:true,
//端口号
port:3000,
//自动打开浏览器
open:true,
}
修改为如下代码( //webpack5中不用配置comtentBase了,注释掉后正常打包)
devServer:{
//comtentBase:resolve(__dirname,'build'),
compress:true,
port:3000,
open:true,
}
在此鸣谢 狗蛋