A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Proposal: import maps for controlling JS imports


Import maps allows control over what URLs get fetched by JavaScript import statements and import() expressions, and allows this mapping to be reused in non-import contexts. This solves a variety of important use cases, such as:

  • Allowing “bare import specifiers”, such as import moment from "moment" , to work on the web
  • Providing fallback resolution, so that import $ from "jquery" can try to go to a CDN first, but fall back to a local version if the CDN server is down
  • Enabling polyfilling of, or other control over, built-in modules
  • Sharing the notion of “import specifiers” between JavaScript importing contexts and traditional URL contexts, such as fetch() , <img src=""> or <link href="">

Check out the linked explainer for more details, and some example code!

Currently this proposal has high community and browser vendor engagement, and we are looking to move it into WICG as a result:

Looking forward to folks feedback!


Sounds good. Migrated to WICG repo: https://github.com/WICG/import-maps.