WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' f

小弟初学webpack 在安装初始化的时候遇到了一些问题“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.”的问题。 

也就是把项目打包进文件失败的意思。

WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' f_第1张图片

解决办法:

1.首先检查配置“webpack.config.js”是否存在。

WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' f_第2张图片

2.检查其内容 目标文件和输出文件是否正确,目录是否存

WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' f_第3张图片

3.查看package.json配置文件并修改(两句添加上)

WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' f_第4张图片

 

4.然后执行命令

“npx webpack ./src/page/index/index.js  ./dist/app.js --modedevelopment

解决问题     ^_^

 

 

你可能感兴趣的:(编程错误)