如何使用webpack-dev-middleware设置webpack --mode?

时间:2018-03-16 11:12:04

标签: express webpack webpack-dev-server webpack-dev-middleware webpack-4

我有一台快速服务器使用webpack-dev-middlewarewebpack-dev-server运行我的应用。

更新到webpack@4.1.1后,我收到以下警告

WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.

由于我没有直接从CLI运行webpack,如何设置--mode选项?

1 个答案:

答案 0 :(得分:4)

也可以在webpack配置对象中设置mode选项:

{
    mode: 'development'
}

可在此webpack-demo

中找到更多相关信息配置 Webpack 4