gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1384
阅读:4471回复:1

vue npm run build打包报错:Class extends value undefined is not a constructor or null

楼主#
更多 发布于:2022-01-19 00:05

解决方案(无效):npm install --save-dev mini-css-extract-plugin 即可

(本人未用此方法,用下面一种方法成功):

执行npm add webpack@4.5.0,解决

npm add webpack@5.0.0
gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1384
沙发#
发布于:2022-01-19 00:06
一、问题描述
执行 npm run build:prod




 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> (C:\Users\司超龙\IdeaProjects\vue\base_education_vue\base_education_third_3.0+\grass-roots teaching system\node_modules\mini-css-extract-plugin\dist\CssDependency.js:12:46)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\司超龙\IdeaProjects\vue\base_education_vue\base_education_third_3.0+\grass-roots teaching system\node_modules\mini-css-extract-plugin\dist\index.js:12:45)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-admin-template@4.4.0 build:prod: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-admin-template@4.4.0 build:prod 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!     C:\Users\司超龙\AppData\Roaming\npm-cache\_logs\2021-03-26T13_04_34_482Z-debug.log




执行num run build:prod 报错,但是npm run dev没问题


二、解决
TypeError: Class extends value undefined is not a constructor or null at Object.<anonymous> (C:\Users\司超龙\IdeaProjects\vue\base_education_vue\base_education_third_3.0+\grass-roots teaching system\node_modules\mini-css-extract-plugin\dist\CssDependency.js:12:46)


CssDependency的问题,依赖包不兼容


执行npm add webpack@4.5.0,解决
————————————————
版权声明:本文为CSDN博主「scl、」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_24654501/article/details/115254960
游客


返回顶部