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
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:
- 389 GitHub stars, and lots of activity on the issue tracker
- Guy Bedford is helping with the spec and discussions, and has provided a polyfill as part of his ES module shims project.
- A maintainer of the yarn package manager has prototyped an import map generator (targeting an earlier version of the spec under the name import maps)
- It’s being prototyped in Chrome
- Discussion at a TPAC breakout session (unfortunately unminuted) about built-in modules, among various members of the web community and browser vendors, was generally supportive.
Looking forward to folks feedback!