webpack 模式报错 The ‘mode‘ option has not been set.

WARNING in configuration
The ‘mode‘ option has not been set. Set ‘mode‘ option to ‘development‘ or ‘production‘ to enable defaults for this environment.
Possible values for mode are: none, development or production(default).

网上查找了一些,发现实际都是没用的,于是自己在官方报错文档中查找,终于解决了这个报错

这是因为 mode 定义的错误:
在配置文件 webpack.config.js 文件中,设置:
webpack 模式报错 The ‘mode‘ option has not been set._第1张图片
模式可以设置下面三种:
webpack 模式报错 The ‘mode‘ option has not been set._第2张图片
具体它们的作用参见:官方文档 Mode

你可能感兴趣的:(webpack)