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

utopian-minify

v1.0.1

Published

A post-processing tool that creates dual builds with import maps for cross-origin caching

Downloads

307

Readme

utopian-minify

A post-processing tool that creates dual builds with import maps for cross-origin dependency caching. It runs after your bundler's build, creates a second "mini" build with dependencies externalized to a CDN via import maps, and rewrites index.html to conditionally load the mini build when the browser supports the Native URL scheme.

Installation

npm install -D utopian-minify

Usage

Add to your package.json scripts:

{
  "scripts": {
    "build": "vite build",
    "postbuild": "utopian-minify"
  }
}

The bundler is auto-detected from your config file (vite.config.*, webpack.config.*, or rollup.config.*).

CLI Options

utopian-minify --bundler vite        # explicit bundler override
utopian-minify --outDir dist         # custom output directory
utopian-minify --exclude lodash,dayjs  # exclude packages from externalization
utopian-minify --verbose             # detailed logging

| Option | Default | Description | |--------|---------|-------------| | --bundler | auto-detect | Bundler to use (vite, webpack, rollup) | | --root | cwd | Project root directory | | --outDir | dist | Build output directory | | --exclude | none | Comma-separated packages to keep bundled | | --verbose | off | Print detailed build info |

How It Works

  1. Reads your package.json dependencies and their exact installed versions from node_modules
  2. Runs a second build with all dependencies marked as external
  3. Scans the mini build output with es-module-lexer to find the actual import specifiers used
  4. Generates an import map mapping each specifier to a native://esm/{pkg}@{version} URL
  5. Rewrites index.html with the import map and conditional loading:
<script type="importmap">
  { "imports": { "react": "native://esm/[email protected]" } }
</script>
<script type="module">
  if (window.NATIVE_SCHEME_SUPPORT) {
    await import("/mini/index-abc123.js");
  } else {
    await import("/assets/index-abc123.js");
  }
</script>

Output

dist/
├── index.html           # unified loader with import map
├── assets/              # standard build (fallback)
│   ├── index-xxxxx.js
│   └── index-xxxxx.css
└── mini/                # externalized build
    └── index-xxxxx.js

Bundler Support

Supports Vite, Webpack, and Rollup. The architecture uses a bundler adapter pattern (see src/adapters/) — contributions for additional bundler adapters are welcome.

| Bundler | Config File | Notes | |---------|-------------|-------| | Vite | vite.config.* | Full support | | Webpack | webpack.config.* | Requires html-webpack-plugin for HTML output. Uses experiments.outputModule for ESM. | | Rollup | rollup.config.* | Requires an index.html in the output directory (e.g. via @rollup/plugin-html). |

License

MIT