vue项目使用webpack打包失败出现 一下错误 :
(node:9792) DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks
instead (node:9792) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instea
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. You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
解决方法 :
此问题是由于webpack版本更新到最新版本引起的,答主退回到3.0.0版本解决此问题。
从webpack4.x开始,webpack-cli 和 webpack是单独安装的,而之前的版本都是在一起的,所以需要都卸载。
01.删除全局webpack-cli
npm uninstall -g webpack-cli
02.删除本地(局部)webpack-cli
npm uninstall webpack-cli
03.删除全局webpack
npm uninstall -g webpack
04.删除本地webpack
npm un webpack
05.安装指定版本webpack,选择稳定版本,全局安装webpack3.0.0版
npm install webpack@3.0.0 -g
06.本地安装webpack3.0.0版
npm install --save-dev webpack@3.0.0
07.项目初始化,
npm i
08.运行webpack打包命令,dist文件出现,ok成功!
webpack
网友评论