The 'mode' option has not been set, webpack will fallback to

The ‘mode’ option has not been set, webpack will fallback to ‘production’ for,Module not found: Error: Can’t resolve

运行环境:

  • windows
  • nodejs v10.15.3
  • webpack v4.38.0

我先全局安装了webpack和webpack-cli:

npm install -g webpack
npm install -g webpack-cli

然后运行webpack去打包时报错:
The 'mode' option has not been set, webpack will fallback to
仔细看webpack官网手册发现,需要设置或者指定模式后才能进行webpack相关操作:

webpack --mode development app.js bundle.js

配置选项

参数 说明 输入类型 默认值
–mode 用到的模式,“development” 或 “production” 之中的一个 string
上一篇:Git 日常命令


下一篇:Vue项目打包卡住在building for production...