Gathering detailed insights and metrics for rollup-plugin-import-map
Gathering detailed insights and metrics for rollup-plugin-import-map
Gathering detailed insights and metrics for rollup-plugin-import-map
Gathering detailed insights and metrics for rollup-plugin-import-map
rollup-plugin-eik-import-map
Rollup plugin that uses Eik defined import map files to transform bare import specifiers to absolute URLs in ES modules
@eik/rollup-plugin-import-map
Rollup plugin that uses Eik defined import map files to transform bare import specifiers to absolute URLs in ES modules
rollup-plugin-import-map-resolve
Resolve import specifiers against import maps.
rollup-plugin-map-import-id
a plugin map import id
Rollup plugin to apply import map mappings to ESM a head of time.
npm install rollup-plugin-import-map
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
10 Stars
93 Commits
1 Forks
3 Watchers
6 Branches
5 Contributors
Updated on Jul 01, 2025
Latest Version
3.0.0
Package Id
rollup-plugin-import-map@3.0.0
Unpacked Size
9.09 kB
Size
3.05 kB
File Count
4
NPM Version
8.19.2
Node Version
16.17.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Rollup plugin to apply import map mapping to ECMAScript modules (ESM) ahead of time.
1$ npm install rollup-plugin-import-map
1import { rollupImportMapPlugin } from "rollup-plugin-import-map"; 2 3export default { 4 input: "source/main.js", 5 plugins: [rollupImportMapPlugin('source/import-map.json')], 6 output: { 7 file: "build.js", 8 format: "esm", 9 }, 10};
This plugin transforms import specifiers in ESM based on mappings defined in one or more import maps. Import maps are an emerging specification yet to be implemented in browsers, however this module can be used to apply import maps ahead of time.
One use case for import maps is to transform ESM bare import statements to an import statement which is an absolute URL to the same module on a CDN.
Lets say we have the following in our ESM when developing locally with node.js:
1import {html, render} from 'lit-html';
Then on build we can apply the following import map:
1{ 2 "imports": { 3 "lit-html": "https://cdn.eik.dev/npm/lit-html/v1/lit-html.js", 4 } 5}
When applied, our output wil be:
1import * as lit from 'https://cdn.eik.dev/npm/lit-html/v1/lit-html.js'
The API of the plugin is fairly simple. The plugin can take a absolute path to a import map or an import map as an object directly. Values can be passed on as a single value or an Array of multple values.
An absolute path to a import map file:
1export default { 2 input: "source/main.js", 3 plugins: [rollupImportMapPlugin('source/import-map.json')], 4 output: { 5 file: "build.js", 6 format: "esm", 7 }, 8};
Absolute paths to multiple import map files:
1export default { 2 input: "source/main.js", 3 plugins: [rollupImportMapPlugin([ 4 'source/import-map-a.json', 5 'source/import-map-b.json', 6 'source/import-map-c.json', 7 ])], 8 output: { 9 file: "build.js", 10 format: "esm", 11 }, 12};
Mix of absolute paths to import map files and import maps provided as an object:
1export default { 2 input: "source/main.js", 3 plugins: [rollupImportMapPlugin([ 4 'source/import-map-a.json', 5 { 6 "imports": { 7 "lit-html": "https://cdn.eik.dev/npm/lit-html/v1/lit-html.js", 8 } 9 }, 10 'source/import-map-b.json', 11 ])], 12 output: { 13 file: "build.js", 14 format: "esm", 15 }, 16};
When an array of import maps is provided and multiple import maps use the same import specifier, the last import specifier in the array will be the one which is applied.
Any mappings defined by any of the means described above must not occur in the Rollup external
option.
If so, this module will throw.
In other words, this will not work:
1export default { 2 input: "source/main.js", 3 external: ["lit-element"], 4 plugins: [ 5 rollupImportMapPlugin({ 6 imports: { 7 'lit-element': 'https://cdn.eik.dev/lit-element/v2' 8 }, 9 }), 10 ], 11 output: { 12 file: "build.js", 13 format: "esm", 14 }, 15};
Copyright (c) 2020 Trygve Lie
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
5 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 4
Reason
Found 0/26 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More