Edge not loading ES 6 modules

2019-07-24 14:39发布

问题:

Microsoft Edge doesn't load my ES 6 modules. All other browsers (Opera, Safari, Chrome, Firefox) do.

It downloads them all fine but doesn't run them. I see only the non-module file. And the console does not report any errors.

I am using Edge 17.17134 on Windows 10.

This page suggests that Microsoft Edge with build number 16299 and above supports ES6 modules. As you can see from my version information above, my build number is 17134, so it must support them.

My page has the following 3 scripts included:

<script src="/Scripts/my/IfIE.js"></script>
<script src="/Scripts/my/sathyaish.js" type="module"></script>
<script src="/Scripts/my/index.js" type="module"></script>

It downloads them all fine:

But it loads only the non-module script in the debugger:

回答1:

  1. Navigate to about:flags
  2. Enable Enable experimental JavaScript features

And use <script type='module' src='./app.js'> will work.

source