This package has been deprecated

Author message:

Package no longer supported. Contact Support at for more info.

TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published


A snowpack plugin that maps your imports to Skypack or other sources.

Maintainer Note

This plugin won't add new feature as Snowpack deprecated. However, I'll keep this repo up to date for security and performance as a maintainer.

For who finding modern frontend stack, please see Vite and rollup.

Changes after the note

  • We moved the module from CJS to ESM
  • We moved the testing library from Jest to Ava
  • We moved the package manager from Yarn to Pnpm


npm install --save-dev snowpack-plugin-import-map
yarn add --dev snowpack-plugin-import-map
pnpm add --dev snowpack-plugin-import-map

Quick Start

Step 1: Modify your snowpack config to include the 'snowpack-plugin-import-map' plugin:

module.exports = {
  extends: '@snowpack/app-scripts-react',
  plugins: [
        // map of packages to imports (required)
        imports: {
          // import the currently installed version of react-dom from
          'react-dom': true,
          // specify the exact URL to load the dependency from
          react: '^16.13.1',

          // Or, import all top-level dependencies from
          '*': true,
          // (with one exception)
          'a-package': false
        // if true, import-map transforms imports in development mode too. default: false.
        dev: true,
        // supported extensions. default: ['.js', '.jsx','.tsx', '.ts']
        extensions: ['.js', '.jsx','.tsx', '.ts'],
        // use custom cdn URL builder instead of Skypack.
        getCdnURL: (source, version, isDev) => {
          return `${source}/${version.replace(/[^\d.]/g, '')}/umd/${source}.${isDev ? 'development' : 'production.min'}.js`

Note: we don't recommend using this plugin for mapping one package name to another. For that, Snowpack has import aliases built in.

Note: if you use custom cdn URL builder, some CDN providers may not handle your package, so you must check the existence of the package yourself.

Step 2: npx snowpack build or npx snowpack dev

Transforms this:

// Before
import React from 'react'
import ReactDOM from "react-dom"

  <h1>Hello world!</h1>,

Into this, which can be run directly in the browser without web_modules deps.

// After
import React from "^16.13.1";
import ReactDOM from "^16.13.1";

  React.createElement("h1", null, "Hello world!"),

Skypack offers blazing fast downloads and great caching, so it will most likely improve your website's loading time. Packages you import from Skypack are optimized for the user's exact browser, so modern browsers load less code.

Offloading your dependencies to a CDN also reduces the amount of code your server has to serve—reducing your costs! If you import all dependencies from Skypack, your server will only have to supply your source files. This makes it much easier to deploy your application to a CDN 🎉

Package Sidebar


npm i snowpack-plugin-import-map

Weekly Downloads






Unpacked Size

28.8 kB

Total Files


Last publish


  • seia
  • zhoukekestar