Water Cooler v2
Water Cooler v2

Reputation: 33850

Edge not loading ES 6 modules

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

Upvotes: 11

Views: 4241

Answers (2)

Andrei Prakhov
Andrei Prakhov

Reputation: 206

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.

Upvotes: 0

Ankit Sinha
Ankit Sinha

Reputation: 1680

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

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

source

Upvotes: 1

Related Questions