← Back to release summary

Import maps

Category
JavaScript
Type
New or changed feature
Status
Enabled by default (Chrome 89)
Intent stage
Shipped

Summary

Import maps allows control over what URLs get fetched by JavaScript import statements and import() expressions.

Motivation

Web developers with experience with pre-ES2015 module systems, such as CommonJS, or web developers using popular tools like Webpack and TypeScript, are used to being able to import JavaScript modules by "bare specifier" names, such as import $ from "jquery" or import { pluck } from "lodash". This system allows easy coordination across the ecosystem: anyone can write a module and include an import statement using a package's well-known name, and let the Node.js runtime, or their build tooling, take care of translating this into an actual file on disk (including figuring out versioning considerations). Import maps bring this ability to the web's native module system, putting it on parity with web developer expectations. Additionally, due to the general nature of how import maps decouple import specifiers from URLs, they allow better caching properties for module script graphs. This use of import maps goes beyond improving the developer experience, to give user-facing performance benefits.

Standards & signals

Docs: https://docs.google.com/document/d/1vFQzbmxg9ilpg8CT_P8roEYcpTfZ06Q5N4J9-ZQqqZo/edit?usp=sharing

Explainers: https://github.com/WICG/import-maps/blob/master/README.md

View on chromestatus.com