无法解析模块说明符“铯”?

时间:2020-06-12 20:55:38

标签: asp.net typescript visual-studio cesium

我有一个模块“ 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 "../".
  • 什么原因导致此错误,以及如何解决?

0 个答案:

没有答案