A Rollup plugin to apply import map mappings during the build process, enabling module resolution according to the WICG import map specification. Current stable version is v3.0.0 (ESM-only, supports Rollup 3). There is also a v4.0.0-next.1 pre-release with full import map support but significant API changes. The plugin wraps the `@import-maps/generate` library to resolve bare specifiers to URLs defined in an import map JSON. It is one of few Rollup plugins that implement import map resolution, distinct from `@rollup/plugin-node-resolve` which resolves to node_modules. Release cadence has been low; breaking changes between major versions require migration attention.
npm install rollup-plugin-import-mapVerified import paths — ran on the pinned version, not inferred.
Configures Rollup with import-map plugin to map 'lodash' to a CDN URL, then bundles to 'dist'.
Provide a base URL as first argument: importMapPlugin(baseUrl, ...options)
Use ESM imports and upgrade to Rollup 3. If CJS needed, stay on v2.
Update plugin configuration to follow new import map JSON structure.
Use default import, not named: import importMap from '...'
Ensure all values in import map imports are fully qualified URLs (e.g., https://...).
Switch to ESM: set "type": "module" in package.json or use .mjs extension, then use import.
Use default import: import importMapPlugin from 'rollup-plugin-import-map'
Call as importMapPlugin(new URL('https://example.com'), {...})