前端打包报错:TypeError: Class extends value undefined is not a constructor or nul

报错TypeError: Class extends value undefined is not a constructor or nul

在执行npm run build的时候遇到了错误:TypeError: Class extends value undefined is not a constructor or null;而执行npm run serve是可以正常执行的,报错如下:

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)...

根据报错可得是mini-css-extract-plugin这个插件有问题,于是去这个插件npm官网看了一下,解决方法有两种:

第一种是安装这个插件:

npm install --save-dev mini-css-extract-plugin //在项目开发依赖中安装
 

第二种是升级webpack版本(如果无效可以先卸载,再安装):

 
npm install webpack -g // 全局安装
npm install webpack --save-dev //在项目开发依赖中安装
posted @   背着泰山找黄河  阅读(6142)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
历史上的今天:
2018-03-21 JavaScript中的基本数据类型
2018-03-21 Spring Data Jpa简单了解
点击右上角即可分享
微信分享提示