npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

import-map-webpack-plugin

v1.0.3

Published

A Webpack plugin for managing import maps and aliasing module paths.

Readme

Import Map Webpack Plugin

npm version npm downloads license

The Import Map Webpack Plugin is a Webpack plugin that mimics an import map for your modules.

Unlike traditional Webpack aliases, this plugin allows resolution of remote URLs at the bundler level — enabling you to alias modules from CDNs or other remote sources directly. This fills a gap since Webpack does not support import maps natively.

✨ Features

  • Resolve modules using an import-map–like configuration.
  • Seamlessly alias remote URLs (CDNs, external scripts, etc.).
  • Supports custom mappings for local and external libraries.

📦 Installation

Install with the package manager of your choice:

npm install import-map-webpack-plugin --save-dev

or

yarn add import-map-webpack-plugin --dev

or

pnpm add import-map-webpack-plugin -D

🚀 Usage

Webpack Example

Add the plugin to your Webpack configuration:

// webpack.config.js
import ImportMapPlugin from "import-map-webpack-plugin";

export default {
  // Other Webpack configuration...
  plugins: [
    new ImportMapPlugin({
      aliases: {
        react: "https://cdn.skypack.dev/react",
        "react-dom": "https://cdn.skypack.dev/react-dom",
      },
    }),
  ],
};

Now instead of

import { useState } from "https://cdn.skypack.dev/react";

You can simply do:

import { useState } from "react";

Next.js Example

You can configure the plugin in next.config.ts:

// next.config.ts
import type { NextConfig } from "next";
import ImportMapPlugin from "import-map-webpack-plugin";

const nextConfig: NextConfig = {
  webpack: (config, { isServer }) => {
    config.plugins.push(
      new ImportMapPlugin({
        aliases: {
          react: "https://cdn.skypack.dev/react",
          "react-dom": "https://cdn.skypack.dev/react-dom",
        },
      })
    );
    return config;
  },
};

export default nextConfig;

Now you can safely import remote modules with aliases in your Next.js pages/components:

import { useState } from "react";

export default function Home() {
  const [count, setCount] = useState(0);
  return (
    <div>
      <h1>Count: {count}</h1>
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
}

Options

  • aliases (object): Custom mapping for module paths.
{
  aliases: {
    lodash: "https://cdn.skypack.dev/lodash-es",
  }
}

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

📄 License

This project is licensed under the MIT License.