Support Import Maps in any browser with es-module-shims

JavaScript Import Maps – which I wrote about earlier here — are a great addition to the web. Unfortunately they’re only supported in Chromium 89+. Thankfully there’s a polyfill available: es-module-shims. As long as your browser has baseline ES Module Support (Chrome 61+, Firefox 60+, Safari 10.1+, and Edge 17+) the polyfill will work. To …


This content originally appeared on Bram.us and was authored by Bramus!

JavaScript Import Maps – which I wrote about earlier here — are a great addition to the web. Unfortunately they’re only supported in Chromium 89+.

Thankfully there’s a polyfill available: es-module-shims. As long as your browser has baseline ES Module Support (Chrome 61+, Firefox 60+, Safari 10.1+, and Edge 17+) the polyfill will work.

To use it, include the script and then write your first import map. The polyfill will automagically do its thing.

<script async src="https://unpkg.com/es-module-shims@0.13.1/dist/es-module-shims.js"></script>

<script type="importmap">
{
  "imports": {
    "app": "./src/app.js"
  }
}
</script>
<script type="module">
  import app from 'app';
  // …
</script>

Also polyfills other things such as Dynamic Imports … NEAT!

es-module-shims (GitHub) →


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2021-09-13T20:24:42+00:00) Support Import Maps in any browser with es-module-shims. Retrieved from https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/

MLA
" » Support Import Maps in any browser with es-module-shims." Bramus! | Sciencx - Monday September 13, 2021, https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/
HARVARD
Bramus! | Sciencx Monday September 13, 2021 » Support Import Maps in any browser with es-module-shims., viewed ,<https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/>
VANCOUVER
Bramus! | Sciencx - » Support Import Maps in any browser with es-module-shims. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/
CHICAGO
" » Support Import Maps in any browser with es-module-shims." Bramus! | Sciencx - Accessed . https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/
IEEE
" » Support Import Maps in any browser with es-module-shims." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/. [Accessed: ]
rf:citation
» Support Import Maps in any browser with es-module-shims | Bramus! | Sciencx | https://www.scien.cx/2021/09/13/support-import-maps-in-any-browser-with-es-module-shims/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.