在要求输入邮箱的文本域,请填写真实的邮件地址。非真实邮件地址,将收不到回复信息。

前端构建报错Class extends value undefined is not a constructor or null

Web前端 清风 253℃ 0评论

问题

前端项目在本地测试的时候使用npm run serve没有任何问题,而使用npm run build后出现错误,无法继续,报错信息如下:

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. (E:\Learning\admin\node_modules\mini-css-extract-plugin\dist\CssDependency.js:12:46)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (E:\Learning\admin\node_modules\mini-css-extract-plugin\dist\index.js:12:45)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (E:\Learning\admin\node_modules\mini-css-extract-plugin\dist\cjs.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-antd-admin@0.7.4 build: vue-cli-service build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-antd-admin@0.7.4 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache_logs\2025-02-14T02_22_11_682Z-debug.log

前端构建报错Class extends value undefined is not a constructor or null-第0张图片

根据以上错误信息显示,可能是mini-css-extract-plugin插件有问题。解决这个问题有以下两个方法

安装插件


npm install --save-dev mini-css-extract-plugin

升级webpack


npm install webpack -g // 全局安装
npm install webpack --save-dev //在当前项目中安装依赖



转载请注明:清风亦平凡 » 前端构建报错Class extends value undefined is not a constructor or null

喜欢 (0)or分享 (0)
支付宝扫码打赏 支付宝扫码打赏 微信打赏 微信打赏
头像
发表我的评论
取消评论

CAPTCHA Image
Reload Image
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址