vue3之Cesium问题(1)

error:

SyntaxError: The requested module '/node_modules/.vite/cesium.js?v=a500a47f' does not provide an export named 'default'.
 Uncaught (in promise) SyntaxError: The requested module '/node_modules/.vite/cesium.js?v=a500a47f' does not provide an export named 'default'.

solve:

在node_modules的cesium文件夹下面的package.json里面的exports里面添加"./Source/Widgets/widgets.css":"./Source/Widgets/widgets.css"

vue3之Cesium问题(1)_第1张图片

vue:

import * as Cesium from 'cesium';
onMounted(() => {
	const viewer = new Cesium.Viewer('cesiumContainer', {
        url:'https://t0.tianditu.gov.cn/vec_w/wmts?service=WMTS&version=1.0.0&request=GetTile&layer=vec&tk=申请的tk=default&TILEMATRIXSET=w&format=tiles&TILECOL={TileCol}&TILEROW={TileRow}&TILEMATRIX={TileMatrix}',
    });
	console.log('viewer', viewer);
});

你可能感兴趣的:(cesium,前端,vue.js)