【发布时间】:2021-09-25 16:26:58
【问题描述】:
将我的项目的webpack devServer 包从"webpack-dev-server": "3.11.2" 更新为"webpack-dev-server": "4.3.0" 后,我在开始我的项目时遇到了这个问题:
>> npm run start
> backoffice@1.0.0 start
> webpack serve --config webpack.dev.js
[webpack-cli] Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options has an unknown property 'writeToDisk'. 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? }
更新日志似乎没有更新,我只发现了几个新选项:More info here
如何将这个“旧”配置文件转换为新配置文件?
如果可能的话,我在哪里可以找到新的配置选项?
webpack.dev.js:
const {merge} = require('webpack-merge');
const common = require('./webpack.common.js');
const path = require('path');
module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
devServer: {
contentBase: path.join(__dirname, './dist'),
compress: true,
watchContentBase: true,
historyApiFallback: true,
https: false,
open: 'Firefox Developer Edition',
stats: {
colors: true,
},
port: 9002,
proxy: {
'/api': 'http://localhost:9000'
},
writeToDisk: true,
},
});
感谢您的帮助
【问题讨论】:
标签: javascript webpack webpack-dev-server mern