Module scripts should only execute once per page

Fixed Issue #11865922

Details

Author
Jake
Created
May 2, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

// index.html
<!DOCTYPE html>
<meta name="viewport" content="width=device-width, minimum-scale=1.0">
<body>
  <script>
 
    var record = “";
    function addTextToBody(text) {
      const div = document.createElement(‘div’);
      div.textContent = text;
      document.body.appendChild(div);
    }
   
    registerDebugDump(function(text){ record += text+"<br>"; });
  </script>
  <script type="module” src="1.js"></script>
  <script type="module" src="1.js"></script>
  <script type="module">
    import "./1.js";
    import "./1.js";
    import "./1.js";
    addTextTobody(“<"+record+">”);
  </script>
  <script src="2.js"></script>
  <script src="2.js"></script>
</body>

// 1.js
addTextToBody(‘1.js executed.’);

// 2.js
addTextToBody(‘2.js executed.’);

https://cdn.rawgit.com/jakearchibald/f7f6d37ef1b4d8a4f908f3e80d50f4fe/raw/1fcedde007a2b90049a7ea438781aebe69e22762/

1.js should only execute once, but Edge executes it 3 times.

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “James M.”

    • Hello,

      Thank you for providing this information about the issue. After thorough testing, we are unable to reproduce the problem in Edge and find your sample exhibits the same behavior in other browsers. Please update this case when you can provide a working repro and possibly run dxdiag (Windows key + r and type dxdiag, enter, then click Save all Information) and attach the txt file.

      Best Wishes,
      The MS Edge Team

    • This is an experimental feature, so you’ll need to enable experimental JS in Edge.

      If 1.js never executes, the feature isn’t correctly enabled.

      I’ve detailed how to enable this feature across the browsers at https://jakearchibald.com/2017/es-modules-in-browsers/. Once you do that, Edge is the only browser failing this test.

    • Microsoft Edge Team

      Changed Assigned To to “Ed M.”

      Changed Assigned To from “Ed M.” to “Suwei C.”

      Changed Status to “Confirmed”

      Changed Steps to Reproduce

      Changed Assigned To from “Suwei C.” to “Jeff W.”

      Changed Status from “Confirmed” to “In progress”

      Changed Status from “In progress” to “In code review”

      Changed Status from “In code review” to “Fixed”

    • This has been fixed, and will be available in a future Windows Insider flight.  Thanks for your report!

    You need to sign in to your Microsoft account to add a comment.

    Sign in