vite-import-maps weekly downloads statistics
By riccardoperra · npm · Vite plugins
A Vite plugin that manages import maps for shared dependencies in your Vite applications.
vite-import-maps has 1,318 recorded weekly downloads on npm, a decrease of 97.6% over the past 30 days, ranking #2000 of 3,247 tracked listings.
About vite-import-maps
vite-import-maps keeps a browser import map aligned with Vite's module resolution. Declare packages or local entry points once; the plugin resolves them through the dev server and emits dedicated chunks during a production build.
It is designed for micro-frontends, plugin systems, and applications that load ESM modules at runtime while hosting shared dependencies themselves.
- Works in Vite development and production builds
- Maps package specifiers and local ESM wrapper modules
- Injects the map into HTML, exposes it as a virtual module, or emits JSON
- Optionally adds integrity metadata to production chunks
- Runs integration tests against Vite 6, 7, and 8
Table of contents
- Install
- Quick start
- Do you need this plugin?
- Configuration
- Consume the import map
- Remote builds
- CommonJS compatibility
- Browser compatibility
- How it works
- Troubleshooting
- Examples
- Development
- License
Install
Requirements
- Vite 6 or newer
- A Node.js version that provides
util.styleText:- Node.js 20.12.0 or newer on the 20.x release line
- Node.js 21.7.0 or newer on the 21.x release line
- Node.js 22 or newer
pnpm add -D vite-import-maps
npm install --save-dev vite-import-maps
yarn add --dev vite-import-maps
Quick start
Add the plugin to the host application—the application that serves the import map and shared modules:
Package entries such as clsx and react must already be installed in the host project.
import { defineConfig } from "vite";
import { viteImportMaps } from "vite-import-maps";
export default defineConfig({
plugins: [
viteImportMaps({
imports: [
// Expose installed dependencies under their package specifiers.
"clsx",
"react",
"react-dom",
"react/jsx-runtime",
// Expose a local module under a public specifier.
{ name: "my-shared-lib", entry: "./src/my-shared-lib.ts" },
],
}),
],
});
By default, the plugin prepends an import map to the generated HTML. A simplified production map looks like this:
<script type="importmap">
{
"imports": {
"clsx": "./clsx.js",
"react": "./react.js",
"react-dom": "./react-dom.js",
"react/jsx-runtime": "./react_jsx-runtime.js",
"my-shared-lib": "./my-shared-lib.js"
}
}
</script>
Production filenames follow your Vite output configuration, so they may include hashes.
[!NOTE] React,
clsx, and other npm packages may resolve to CommonJS entry points. The plugin provides a compatibility wrapper when it can detect their exports. For explicit control, expose a local ESM wrapper such asreact-esm.ts. See CommonJS compatibility.
[!IMPORTANT] If a separately built remote imports one of these specifiers, configure that dependency as external in the remote build. Otherwise the remote will bundle its own copy and the import map will not provide a shared instance.
Do you need this plugin?
This plugin is a good fit when the browser loads ESM modules at runtime and more than one part of your application needs to resolve the same bare import specifiers.
Typical use cases include:
- Micro-frontends — A host and independently delivered remotes need to resolve shared dependencies such as React, Vue, or Solid.
- Plugin systems — Runtime-loaded plugins import APIs or libraries provided by the host application.
- Self-hosted dependency sharing — You want the host to build and serve shared modules instead of loading them from a public CDN.
- Custom public entry points — You want an import-map specifier to resolve to a local wrapper, a curated set of exports, or an application-owned module.
The plugin is most valuable when you want to use browser import maps without manually keeping development URLs and production chunk filenames in sync. The host becomes the source of truth: it resolves each configured entry with Vite, then exposes the resulting map to the browser.
You may not need it when
- Your application does not load modules at runtime.
- Every dependency can stay inside one conventional application bundle.
- A CDN-generated import map already meets your deployment and versioning requirements.
- You need a complete micro-frontend runtime with remote discovery, version negotiation, fallbacks, or deployment orchestration. This plugin generates and exposes import maps; it does not provide those higher-level features.
Why self-host shared modules?
Public services such as esm.sh and JSPM are convenient and may be the simplest option for some applications. Self-hosting is useful when you need tighter control over:…
Description from the npm listing.
- vite
- vite-plugin
- import-maps
- mfe
- import maps
- microfrontend
- plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm Vite plugins plugins
All 20 vite-import-maps alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-import-maps. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.