cesium报错error in ./node_modules/cesium/Source/ThirdParty/zip.js 的解决办法

在尝试使用Vue和CLI搭建的项目中集成Cesium 1.87.1版本时,遇到模块解析错误,提示不支持的token。尝试添加`@open-wc/webpack-import-meta-loader`加载器未解决问题。解决方案是回退到Cesium 1.8.0版本,并确保在package.json中不使用`^`符号,以防止自动升级到最新版本导致错误。

最近接触cesium项目,按照网上的教程,vue+cli创建项目后,cesium版本为1.87.1,结果发现报错,

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

  2. Module parse failed: Unexpected token (1565:71)

  3. You may need an appropriate loader to handle this file type.

  4. | if (!workerData.interface) {

  5. | try {

  6. | workerData.worker = new Worker(new URL(workerData.scripts[0], import.meta.url));

  7. | } catch (error) {

  8. | workerData.worker = new Worker(new URL(workerData.scripts[0], import.meta.url), { type: "module" })

查找了很多资料,也根据网上的教程添加

module: {
      rules: [
      {
      test: /\.js$/,
      use: {
      loader: '@open-wc/webpack-import-meta-loader',
      },
      },
    ]}

还是没有用,在GitHub上找到了如下的回复

 当前的解决办法是回退到1.8.0版本千万记住不要在1.8.0前面加^,加上还是会报错,因为他会下载最新的版本

 

Cesium.js:80 An error occurred while rendering. Rendering has stopped. TypeError: viewer.scene.globe.sampleHeight is not a function TypeError: viewer.scene.globe.sampleHeight is not a function at VueComponent.routePlay (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/bigScreen/impression/guide/index.vue?vue&type=script&lang=js:707:41) at VueComponent.dynamicRoute (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/bigScreen/impression/guide/index.vue?vue&type=script&lang=js:597:12) at eval (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/bigScreen/impression/guide/index.vue?vue&type=script&lang=js:757:15) at Object.complete (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/views/bigScreen/impression/guide/index.vue?vue&type=script&lang=js:938:23) at newOptions.complete (Cesium.js:72:2547841) at Object.<anonymous> (Cesium.js:72:2505912) at i.Tween.update (Cesium.js:65:447462) at TweenCollection.update (Cesium.js:72:3109911) at Scene.initializeFrame (Cesium.js:72:3192945) at CesiumWidget.render (Cesium.js:80:166273)
最新发布
08-12
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LJR_BLOG

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值