webpack4打包报错: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 fo

时间:2023-12-24 12:34:37

运行命令webpack ./src/main.js ./dist/murenziwei.js后,目录上神马动静都没有,你以为在dist文件夹上会有murenziwei.js吗?毛都没有

webpack4打包报错: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 fo

警告和错误倒是有,警告说我没有设置mode?错误说我配置打包出入口有问题?

webpack4打包报错: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 fo

为了快点打包成功,我老老实实的服从,将上面webpack命令改为webpack ./src/main.js --output-filename ./dist/murenziwei.js --output-path . --mode development,然后按下Enter,我的解决了,你的呢?

  • --output-filename:设置要打包的文件目录
  • --output-path:打包文件放置的文件目录
  • --mode:告诉程序,在当前目录,我是属于开发状态development

webpack4打包报错: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 fo

webpack4打包报错: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 fo

再来最后一眼,瞧瞧murenziwei.js都有啥?

webpack4打包报错: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 fo