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

exploring ie11 support #14

Closed
chase-moskal opened this issue May 16, 2019 · 1 comment
Closed

exploring ie11 support #14

chase-moskal opened this issue May 16, 2019 · 1 comment

Comments

@chase-moskal
Copy link

  1. i'm trying to see if i can get es-module-shims working in ie11

  2. i created an es5 branch of es-module-shims, which uses babel to generate an es5 script es-module-shims.es5.js

  3. in my repo for a web component i'm working on, i've included polyfills and am using es-module-shims.es5.js as follows

    <script src="https://unpkg.com/@babel/[email protected]/dist/polyfill.min.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/fetch.umd.js"></script>
    <script>
      // inject console logging for each 'fetch' call
      var f = window.fetch
      window.fetch = function() {
        console.log("fetch", arguments[0])
        return f.apply(window, arguments)
      }
    </script>
    <script src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-bundle.js"></script>
    <script type="importmap-shim" src="dist/importmap.json"></script>
    <script type="module-shim" src="source/demo.js"></script>
    <script src="assets/es-module-shims.es5.js"></script>
  4. other browsers are working, but when source/demo.js goes to import "./register-all.js", ie11 incorrectly issues a request for /register-all.js instead of resolving it to source/register-all.js — in other words, in ie11, a request is made for register-all.js at the server root, not within source/

    // CHROME 71
    fetch http://localhost:5000/dist/importmap.json
    fetch http://localhost:5000/source/demo.js
    fetch http://localhost:5000/source/register-all.js
     // continues to load application
    
    // INTERNET EXPLORER 11
    fetch http://192.168.1.73:5000/dist/importmap.json
    fetch http://192.168.1.73:5000/source/demo.js
    fetch http://192.168.1.73:5000/register-all.js
     // fetch for "/register-all.js" fails with 404
    

let me know if you have a hunch about what might be going on, or if perhaps there could be further reasons of which i'm not yet aware that could make ie11 support impossible

@guybedford
Copy link
Owner

Yes this project doesn't support IE11, rather the recommendation for these environments is to compile ES modules into the System.register format and use SystemJS, which also supports import maps - https://github.com/systemjs/systemjs, as that ensures exact semantics equivalence.

But in many cases you might not even need import maps and exact semantics equivalence such that any other legacy workflow could apply (shimport / single-file builds / etc).

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