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

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打包出现WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. 错误

 

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

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

 

 

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

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

 

相关文章: