在執(zhí)行npm run build
的時候遇到了錯誤:TypeError: Class extends value undefined is not a constructor or null敢辩;而執(zhí)行npm run serve
是可以正常執(zhí)行的,報錯如下:
Building for production...
ERROR TypeError: Class extends value undefined is not a constructor or null
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (E:\etest\lsj_test\node_modules\mini-css-extract-plugin\dist\CssDependency.js:12:46)...
根據(jù)報錯可得是mini-css-extract-plugin
這個插件有問題,于是去這個插件npm官網(wǎng)看了一下裙犹,解決方法有兩種:
第一種是安裝這個插件:
npm install --save-dev mini-css-extract-plugin //在項目開發(fā)依賴中安裝
第二種是升級webpack版本(如果無效可以先卸載搁宾,再安裝):
npm install webpack -g // 全局安裝
npm install webpack --save-dev //在項目開發(fā)依賴中安裝
親測第二種方式可以解決!