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

版权声明:未经同意,不得随意转载转载 https://blog.csdn.net/lucky541788/article/details/83215559
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 文件中,设置:
在这里插入图片描述
模式可以设置下面三种:
在这里插入图片描述
具体它们的作用参见:官方文档 Mode

猜你喜欢

转载自blog.csdn.net/lucky541788/article/details/83215559