11
votes

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.

enter image description here

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:

enter image description here

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

enter image description here

2
Where are you importing from index or sathyaish? If im not mistaken the module wont be evaluated until the first import. So if you never have a import statement for it, the browser doesnt bother evaluating it. Trying importing them from some other script and see if that runs them. - Patrick Evans
I can see that there are latest build and newer version of MS Edge is available. Is there is any specific reason that you are using an older version of OS build? If there is no any specific reason than I suggest you to update your OS build and try to make a test with latest version of MS Edge. Let us know about your testing result. We will try to provide further suggestions, If needed. - Deepak-MSFT
@Deepak-MSFT I just noticed its version reads 42.17134.1.0. I got it with a brand new machine. No matter how many times I run Windows update, it won't update Edge. So, I guess it's a pretty recent version. - Water Cooler v2
Can you try to provide a sample of your ES 6 module and any sample code which can use that module? We will try to make a test with it and try to check whether it is running in MS Edge on our side or not. It can help to narrow down the issue. - Deepak-MSFT
Did you ever find a solution for this? I'm having the exact same problem. - Andrew Garrison

2 Answers

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

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

source

0
votes

I had the same issue (other browsers are fine, but not Microsoft Edge (44.18362.387.0), no errors in console, all .js files loaded fine in Network tab). Further investigation showed that the problem was not with loading modules itself. "Hello world" example with modules worked fine in Edge and after that I started to eliminate parts of script that potentially could cause a problem. In my case it was map objects instantiation:

 export default class A {
       static B = new Map();
       static C = new Map();

After replacement with

export default class A {

    constructor() {
        A.B = new Map();
        A.C = new Map();
    }

everything worked fine. So if it is possible to change your scripts, there is a chance to get them work in Edge too.