webpack 出现The 'mode' option has not been set

运行npm run dev时出现
WARNING in configuration
The ‘mode‘ option has not been set. Set ‘mode‘ option to ‘development‘ or ‘production‘ to enable defaults for this environment.
是因为webpackmode未配置导致,我们在package.json中添加配置项:

--mode development

如我们原本的dev是
"scripts": {
    "dev": "webpack-dev-server --inline --hot --port 8082"
  },
改为
"scripts": {
    "dev": "webpack-dev-server --inline --hot --port 8082 --mode development"
  },

评论

大侠名号:   验证码: 点击我更换图片  

修远兮

在这里记录每一点自己需要的知识

添加创始人微信,一起交流心得

推荐文章RECOMMEND