BlogsShopifyImport Maps and JavaScript Module Loading

Import Maps and JavaScript Module Loading

Import Maps and JavaScript Module Loading

2
posts
2024–2025

Shopify has addressed critical adoption issues with JavaScript import maps and module loading. Previously, modules could not load before the import map, and only one import map was allowed per document, causing conflicts and fragility. Shopify collaborated on a web platform-level solution that introduces a reconciliation mechanism. This allows for multiple import maps, modules to load before import maps, and resolves conflicts by merging new maps into a global representation while respecting alignment. This post details the integration of Subresource Integrity (SRI) for imported JavaScript modules by extending import maps, enabling dynamic imports with integrity hashes in Chromium and WebKit browsers.

2025

Resilient Import Maps - Better Theme Development and Beyond (2025) - Shopify

5/28/2025

Shopify identified and addressed two key limitations in the import map specification: the restriction that no module could load before the import map, and the single import map per document rule. They collaborated on a plan that introduced a reconciliation mechanism involving a global import map representation and a resolved module set. A merge algorithm was developed to handle new import maps by dropping rules that would impact already loaded modules and resolving conflicts with existing rules. This change was submitted to the HTML spec, implemented in Chromium and WebKit, and shipped in recent browser versions. Shopify also integrated es-module-shims for older browser support.

2024

Shipping support for module script integrity in Chrome & Safari - Shopify

8/2/2024

Shopify engineers revived Guy Bedford's proposal to integrate integrity metadata into import maps and landed support for subresource integrity in imported module scripts in Chromium and WebKit. This involved creating a working Chromium implementation, updating the HTML spec, and developing a rudimentary test suite. The feature was then implemented in WebKit, leading to its shipping in Chromium 127 (Chrome, Edge) and Safari 18 Beta.