gpt4 book ai didi

javascript - Safari 10.1 es6 模块示例

转载 作者:搜寻专家 更新时间:2023-10-30 21:19:59 25 4
gpt4 key购买 nike

我用它制作了一个 index.html 页面

<script type="module" src="scripts/index.js"></script>

index.js 包含

import 'menu';

第 26 版(Safari 10.2、WebKit 12604.1.12)有问题

TypeError: Module specifier does not start with "/","./","../"

我做错了什么?

请注意,当我将 index.ts 编译为 index.js 时,typescript 没有报错

对我来说最坏的情况是 TypeScript 和 Safari 10.1 需要不同的导入语法,这对我来说是 $%^^(&)(!!!

最佳答案

经过更多测试后,我几乎可以肯定 Safari 10.1 需要 import './menu.js'; 而不是 import 'menu';

试图说服 TypeScript 为其创建一个模块编译器选项。

https://github.com/Microsoft/TypeScript/issues/14861

关于javascript - Safari 10.1 es6 模块示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43027805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com