jeecgboot安装webpack报错

5 篇文章 0 订阅

jeecgboot安装webpack时报错

npm install webpack -g // 全局安装
npm install webpack --save-dev // 项目内安装

错1:
TypeError: Class extends value undefined is not a constructor or null

$ vue-cli-service 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.<anonymous> (/root/deploy/ui/node_modules/mini-css-extract-plugin/dist/CssDependency.js:12:46)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/root/deploy/ui/node_modules/mini-css-extract-plugin/dist/index.js:12:45)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)

原因:(个人猜测)

jeecg支持的webpack版本问题,直接安装时版本高

删除webpack,重新装以前的版本。
npm uninstall webpack
npm install webpack@^4.0.0 --save-dev

错2:
. ERROR Error: Rule can only have one resource source (provided resource and test + include + exclude) in

Building for production... ERROR  Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
   "exclude": [
           null
             ],
       "use": [
              {
      "loader": "cache-loader",
      "options": {
        "cacheDirectory": "D:\\vueProject\\DaYuanShuai-ability-master\\ability\\ant-design-vue-cssc\\node_modules\\.cache\\babel-loader",
        "cacheIdentifier": "276c622c"
             },
      "ident": "clonedRuleSet-38[0].rules[0].use[0]"
             },
              {
      "loader": "thread-loader",
      "options": "undefined",
      "ident": "undefined"
             },
              {
      "loader": "babel-loader",
      "options": "undefined",
      "ident": "undefined"
              }
              ]
              }
Error: Rule can only have one resource source (provided resource and test + include + exclude) in {
  "exclude": [
    null
  ],
  "use": [
    {
      "loader": "cache-loader",
      "options": {
        "cacheDirectory": "D:\\vueProject\\DaYuanShuai-ability-master\\ability\\ant-design-vue-cssc\\node_modules\\.cache\\babel-loader",
        "cacheIdentifier": "276c622c"
      },
      "ident": "clonedRuleSet-38[0].rules[0].use[0]"
    },
    {
      "loader": "thread-loader",
      "options": "undefined",
      "ident": "undefined"
    },
    {
      "loader": "babel-loader",
      "options": "undefined",
      "ident": "undefined"
    }
  ]
}

原因:(个人猜测)

jeecg支持的webpack版本问题,4.0版本低了

最后的解决方法

在安装4.0 版本后又安装一次npm install webpack --save-dev

 "webpack": "^4.46.0"

npm run build 才运行成功

方法

使用4.46.0版本

// An highlighted block
npm install webpack -g
npm install webpack@^4.46.0 --save-dev

以上时个人推测,原理也不是很清楚,如果有大佬明白原理或者更好的方法,欢迎留言

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值