我有一个模块“ Main.js”
import * as Cesium from "cesium";
let map: Cesium.Viewer = undefined;
let createTheMap = function()
{
if (map === undefined )
{
map = new Cesium.Viewer( "mapViewDiv",
{
timeline: false,
animation: false,
infoBox: false,
navigationHelpButton: false,
fullscreenButton: false,
geocoder: false,
shadows: false,
selectionIndicator: false
});
}
map.zoomTo(map.entities);
};
在“ index.html”中,我引用的主要内容如下:
<script src="verot/edi/Main.js" type="module"></script>
和cesium.js如下:
<script type="module" src="cesium/Source/Cesium.js"></script>
我已经在Visual Studio中设置了
ECMAScript : Ecmascript 6
JSX compilation on TSX file : React
Module System : ES2015
我收到以下错误:
Uncaught TypeError: Failed to resolve module specifier "cesium". Relative references must start with either "/", "./", or "../".