webpack打包出现WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. 错误

打包运行的时候出现以下错误

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/

 

 原因是没有设置webpack的模式是"生产环境"还是"开发环境",红框是设置webpack为何种模式

 

 

通常情况:在package.json中设置

"scripts": {
  "dev": "webpack --mode development",
  "build": "webpack --mode production"
},

 

posted @ 2019-09-03 10:23  KIU的博客  阅读(3887)  评论(0编辑  收藏  举报