在Google Maps Javascript API示例中,我看到他们在HTML中有类似的内容:
<script type="module" src="./index.ts"></script>
在TS/JS脚本的末尾有一个空的export语句.
let map;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: -34.397, lng: 150.644 },
zoom: 8,
});
}
window.initMap = initMap;
export {};
我没有在MDN上看到任何空导出的例子或提及,所以我想知道是否有人知道它是如何工作的.如果导出为空,脚本如何知道如何运行它.