vue+cesium报错解决

在Vue项目中使用Cesium库时遇到了错误`error in ./node_modules/cesium/Source/ThirdParty/zip.js`。为了解决这个问题,需要安装`@open-wc/webpack-import-meta-loader`并在`vue.config.js`中配置相应的模块规则。然而,配置后虽然运行正常,但在打包过程中却出现`TypeError: Cannot read property 'length' of undefined`的错误。这个问题可以通过修改`webpack-import-meta-loader.js`文件中的特定代码来解决,注释掉引起错误的行。

问题

error  in ./node_modules/cesium/Source/ThirdParty/zip.js

解决

安装@open-wc\webpack-import-meta-loader

并在vue.config.js中配置

 configureWebpack: {

    name: name,

    module: {

      rules: [

          {

              test: /.js$/,

              use: {

                  loader: '@open-wc/webpack-import-meta-loader',

              },

          },

      ],

    },

}

后遗症

以上配置后运行正常但是打包报错TypeError: Cannot read property 'length' of undefined

解决

修改node_modules\@open-wc\webpack-import-meta-loader\webpack-import-meta-loader.js

中代码

const relativePath = this.context.substring(

  // this.context.indexOf(this.rootContext) + this.rootContext.length + 1,   //注释掉此行代码

  this.resource.lastIndexOf(path.sep) + 1,

);

评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值