最近在研究webpack,当我执行npm run build / npm start / npm run server等命令时,都是提示下面的警告信息

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

大致意思就是:未设置mode(模式),请指定是“开发环境”还是“生产环境”;

如何解决呢?只需要在package.json中添加配置项:

"scripts": {
    "start": " --mode development",
    "build": "--mode production",
  }

执行 npm start 处于开发中调试,有些是 npm run server,只是配置不同而已;执行 npm run build 打包项目,也就是打包成上线后的代码;

 

 

   

相关文章:

  • 2021-12-13
  • 2021-10-10
  • 2021-10-20
  • 2022-12-23
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-13
  • 2021-08-10
  • 2022-12-23
  • 2021-09-30
  • 2021-10-16
  • 2021-05-18
相关资源
相似解决方案