vue項(xiàng)目使用webpack打包失敗出現(xiàn) 一下錯(cuò)誤 :
(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是單獨(dú)安裝的,而之前的版本都是在一起的,所以需要都卸載。
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,選擇穩(wěn)定版本,全局安裝webpack3.0.0版
npm install webpack@3.0.0 -g
06.本地安裝webpack3.0.0版
npm install --save-dev webpack@3.0.0
07.項(xiàng)目初始化,
npm i
08.運(yùn)行webpack打包命令,dist文件出現(xiàn),ok成功!
webpack