##第N天了,我发现有些显卡不足的电脑,对于npm装载的cesium有要求
在我的笔记本上能够运行的vue+cesium代码,换了台机子总是运行不出来,出现如下错误:
Module parse failed: Unexpected token (1565:71)
You may need an appropriate loader to handle this file type.
| if (!workerData.interface) {
| try {
| workerData.worker = new Worker(new URL(workerData.scripts[0], import.meta.url));
| } catch (error) {
| workerData.worker = new Worker(new URL(workerData.scripts[0], import.meta.url), { type: “module” });
@ ./node_modules/cesium/Source/DataSources/KmlDataSource.js 44:0-39
@ ./node_modules/cesium/Source/Widgets/Viewer/viewerDragDropMixin.js
@ ./node_modules/cesium/Source/Cesium.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
这种时候,一般要去提示对应目录中寻找错误,经过几天测试,发现果然是npm安装的cesium有点问题,对于显卡较差的电脑,且出现如上问题,建议使用cesium1.84,暂未发现其他版本。