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

@questpie/vite-plugin-iconify

v0.0.1

Published

Vite plugin that auto-bundles only the Iconify icons you use

Readme

@questpie/vite-plugin-iconify

Vite plugin that automatically bundles only the Iconify icons you actually use. Zero config, zero flash, zero API calls.

How it works

  1. Scans your source files for icon references like "ph:check", "mdi:home", "tabler:star"
  2. Extracts only those icons from @iconify/json (200k+ icons from 150+ sets)
  3. Generates a virtual module that calls addCollection() to preload them
  4. HMR — add a new icon, save, it's bundled automatically

Result: @iconify/react renders inline SVGs instantly. No API calls, no layout shift, no flash of missing icons.

Setup

bun add -d @questpie/vite-plugin-iconify @iconify/json
// vite.config.ts
import { iconifyPreload } from "@questpie/vite-plugin-iconify";

export default defineConfig({
  plugins: [
    iconifyPreload(),
    // ... other plugins
  ],
});
// app.tsx or entry point
import "virtual:iconify-preload";

That's it. Use @iconify/react as normal:

import { Icon } from "@iconify/react";

<Icon icon="ph:check" width={16} height={16} />
<Icon icon="mdi:home" />
<Icon icon="tabler:star-filled" />

Options

iconifyPreload({
  // Glob patterns for files to scan (default: src/**/*.{ts,tsx,js,jsx})
  scan: ["src/**/*.{ts,tsx}", "packages/admin/src/**/*.{ts,tsx}"],

  // Always include these icons (for truly dynamic icon names)
  include: ["ph:spinner", "ph:spinner-gap"],
})

How icon detection works

The plugin scans for string literals matching the pattern "prefix:icon-name" in your source files. This covers:

  • <Icon icon="ph:check" /> — JSX props
  • icon: "ph:article" — object literals (e.g. server config)
  • c.icon("ph:layout") — function arguments
  • "mdi:home" — any string literal

Won't detect: dynamically constructed names like `ph:${variable}`. Use the include option for those.

Why not unplugin-icons?

unplugin-icons requires changing your icon syntax to component imports:

// unplugin-icons — requires import per icon
import IconCheck from "~icons/ph/check";
<IconCheck />

This plugin keeps the standard @iconify/react string-based API:

// @questpie/vite-plugin-iconify — string-based, no imports
<Icon icon="ph:check" />

String-based icon names are essential when icons come from server config, database fields, or any runtime source. This just gives us option to preload the icons we know we'll use, while still allowing dynamic usage when needed.