Andrew's Digital Garden

Import maps

Import maps allow control over what URLs get fetched by JS' import statements at runtime, by offering a separate mapping between the module and it's URL, rather than having to embed the has/location in every file. This allows you to update the imported module (and the import map) without updating the consuming module.

Scopes can be used to help resolve version conflicts. This scopes a resolution based on what the source is. Two files could load the same dependency, but resolve in two different places.

The technology exists in a similar space to [[module federation]], but is supported by browsers natively.

This is becoming a native spec, but is also supported by tools like SystemJS for older browsers/compatibility.

https://web.dev/import-maps-in-all-modern-browsers/ https://github.com/systemjs/systemjs

[[architecture]] [[browsers]] [[buildtooling]] [[microfrontends]] [[microservices]] [[js]] [[rendering]] [[web]]

Import maps