Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 7 min read Case study mediumAdept

Resilient Import Maps - Better Theme Development and Beyond

Shopify worked with browser vendors to change the HTML spec, Chromium and WebKit so import maps no longer break when JavaScript modules load before them or when a page has more than one map. Each document keeps a single global import map and a set of already-resolved module names. Each new map is merged in, dropping any rule that would change an already-resolved module or override an existing rule. The change ships in Chrome 133 and Safari 18.4, and es-module-shims 2.4.0+ polyfills it for older browsers. Shopify injects the polyfill on storefronts automatically, so themes and app blocks can now use hashed, immutably cached modules without load-order conflicts.

Related posts

  • Shipping support for module script integrity in Chrome & Safari

    Shopify Engineering easyNovice

    Subresource Integrity previously covered only top-level scripts, styles and preloads, not imported ES modules, which forced Shopify's PCI-compliant checkout to shim dynamic imports. Shopify revived Guy Bedford's proposal to add an "integrity" section to import maps that maps module URLs to hashes, so static imports, dynamic import(), top-level module scripts and modulepreload are verified before execution without the cache-invalidation cascades import maps avoid. The feature was implemented in both Chromium and WebKit and landed in the HTML spec. It shipped in Chromium 127 and Safari 18 Beta after roughly two weeks of full-time work across seven calendar weeks.

  • What we got wrong about HTTP imports

    Deno easyNovice

    Deno's original module system of direct HTTP URL imports didn't scale. Long URLs cluttered code, `deps.ts` files were clumsy, exact version pinning in URLs led to duplicate copies of the same library, and builds depended on the uptime of every host in the dependency graph. Deno is keeping HTTP imports but now recommends import maps for short specifiers and central version management, plus JSR, a semver-aware registry that resolves `jsr:` specifiers to immutable HTTP URLs. That design keeps granular file downloads and fixes deduplication and reliability. These changes are a core part of Deno 2.

  • Bun v1.1.44

    Bun mediumAdept

    Bun v1.1.44 adds experimental HTML imports (behind --experimental-html) so Bun.serve() can bundle and serve frontend apps on demand alongside API routes, with no hot module reloading yet. It also adds xxHash32/64/3 to Bun.hash for fast non-cryptographic hashing, lets bun.lock and other JSONC files be read via import, and adds a bunx --no-install flag. The release fixes 43 bugs, including node:dns now passing over 90% of Node's tests, broader node:fs compatibility, S3 client fixes, private npm registry auth in .npmrc, and expect.extend regressions.

  • Fixing Top-Level Await in Safari

    WebKit mediumAdept

    Safari 27 fixes long-standing top-level await bugs, such as spurious "accessed before initialization" errors and wrong import completion order, by rewriting WebKit's ES module loader from scratch. The old loader was a self-hosted JavaScript builtin based on the abandoned 2016 WHATWG Loader proposal, so it resolved concurrent dynamic imports of a still-evaluating async module too early. The new loader is native C++ translated directly from the ECMAScript spec's module algorithms, chosen for faster startup and more predictable performance. It was validated with Bun's collected test cases, a differential fuzzer comparing module-graph output against other engines, test262 and WPT.

  • Bun v0.7.1

    Bun mediumAdept

    Bun v0.7.1 makes ES Module loading 30%–250% faster by running its transpiler concurrently for import statements and dynamic imports, though CommonJS require is still sequential. Module resolution now happens only once, at runtime. The release also cuts vite dev startup on Linux by 90%, speeds up bun:sqlite row returns by 10%, and fixes getaddrinfo handling so private registries like Verdaccio work. Node.js compatibility fixes cover fs.watch thread usage, fs.stat truncation on large files, a GC bug in fs.readdir, and making the event loop wait for WebAssembly, Atomics and Web Crypto work, alongside new MessageChannel, fetch file: URLs and Promise.withResolvers support.

The quest for software engineering knowledge.

Look:
Layout: