Cesium问题汇总
1.TypeError: Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’: parameter 1 is not of type ‘WebGLShader’.
老板告诉我,三维demo出问题了,一进页面就出现这个问题。
经过多篇文章的展开,我发现了大家统一的说法就是因为GPU被撑爆了,所以会出现这个问题。
1.大分辨率(12800*3540)的屏幕在chorme使用Cesium时发生报错,求帮助。
2.编辑器不能显示图片:Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’
3.报错:Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’
4.TypeError: Failed to execute ‘shaderSource’ on ‘WebGLRenderingContext’: parameter 1 is not of type ’
2.Visit http://get.webgl.org to verify that your web browser and hardware support WebGL.
在一个chrome浏览器中,出现了下面的问题:
1 | Error constructing CesiumWidget. |
浏览器不支持。
3.Module parse failed: Unexpected token
安装了 codemorrior之后,竟然导致其他的问题出现了:You may need an appropriate loader to handle this file type。后来卸载了codemorrior之后,还是有问题。
【解决方案】
卸载重装1.80.0版本
1 | #卸载当前的Cesium版本 |
【疑问】
不重装之前,我已经在这个工程下工作了好几个月了,怎么今天突然出现了这个问题呢?想不明白。
【新问题】
果真不出所料,同样的工程,同样的代码,今天打开,突然又再次出现了这个问题,真是让人头大,因为我切换了cesium1.80.0之后,已经测试过可以使用了,但是过了一个周末,再次打开工程,发现又再次出现了这个问题:in ./node_modules/cesium-navigation-es6/node_modules/cesium/Source/ThirdParty/zip.js
1.Webpack Error when trying to pack CSS 这个没啥用
2.“/node_modules/cesium/Source/ThirdParty/zip.js” this file can’t not be packed 这里有相同的问题,找到了重装1.80.0的解决方法。
4.Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true
在使用Mars3d的时候,出现了这个问题,其实不影响使用,但是根据提示,可以有更快的速度进行渲染,因为我在渲染图片的时候,只有当全部的图片渲染完成之后,页面才会显示,感觉非常的慢。
5.cesium 地图因为transfrom 导致 地图偏移,点击不准的问题
6.vite打包之后Cesium不存在
打包部署之后出现了: Uncaught (in promise) ReferenceError: Cesium is not defined
【解决方案】
(1)手动将 cesium 文件夹复制到 dist 目录下。
(2)将 vite-plugin-cesium 固定到 1.2.22 版本。
(3)当然也可以使用 rollup-plugin-copy 进行自动复制
【1】.vite打包cesium到线上环境后报错ReferenceError: Cesium is not defined 所以把这个包版本固定在1.2.22再重新打包,这个没有用
【2】.vue3+ts+vite启动正常打包时报错Cannot find name ‘Cesium‘. 把package.json中的”build”: “vue-tsc && vite build” 改为 “build”: “vite build”,没啥用。
【3】.cesium 打包之后在生产环境报 Cesium is not defined等问题。 在plugins配置了cesiumBuildPath和cesiumBaseUrl,记住打完包之后需要手动将\dist\YJXY 下的 Cesium 文件放到\dist目录下;
【4】.vite 复制文件或文件夹到dist 目录 使用 rollup-plugin-copy 进行复制
