Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrome96探测Module失败 #15

Closed
tangjian1891 opened this issue Dec 5, 2021 · 1 comment
Closed

chrome96探测Module失败 #15

tangjian1891 opened this issue Dec 5, 2021 · 1 comment

Comments

@tangjian1891
Copy link

打扰您了,请教一下!
发现在支持esm的浏览器上,也显示出
✖ 模块的export命令
✖ 模板的import命令

判断浏览器是否支持ESM,是否可以使用以下方式判断。
<script type="module">
window.supportESM = true;
</script>

<script nomodule>
  window.supportESM = false;
</script>

  <script>
   setTimeout(() => {
    console.log("是否支持supportESM", window.supportESM);
   }, 1000);
  </script>

我发现普通<script>标签即使放在<script type="module">下方,执行顺序也会快一点,所以增加了1个1秒延迟打印查看。

@ruanyf
Copy link
Owner

ruanyf commented Dec 6, 2021

你的方法可行,但是这个库不打算更新了。

@ruanyf ruanyf closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants