在执行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 //在项目开发依赖中安装
1
第二种是升级webpack版本(如果无效可以先卸载,再安装):
npm install webpack -g // 全局安装
npm install webpack --save-dev //在项目开发依赖中安装
1
2
亲测第二种方式可以解决!文章来源:https://www.toymoban.com/news/detail-568678.html
方法一也可以
————————————————
版权声明:本文为CSDN博主「是猿不是缘」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_51281841/article/details/120221968文章来源地址https://www.toymoban.com/news/detail-568678.html
到了这里,关于报错TypeError: Class extends value undefined is not a constructor or null的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!