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

@appjamstudio/vite-plugin-icon-forge

v0.1.0-beta.1

Published

A Vite plugin that automatically transforms SVG files into React components with TypeScript support, allowing easy import and use of SVG icons in your React applications

Downloads

17

Readme

vite-plugin-icon-forge

A Vite plugin that automatically transforms SVG files into React components with TypeScript support, allowing easy import and use of SVG icons in your React applications.

Features

  • 🔄 Automatic transformation - SVGs are converted to React components on-the-fly
  • 📁 Directory scanning - Automatically generates barrel exports for organized icon imports
  • 🔥 Hot reload - Icon changes are reflected immediately during development
  • 🎯 TypeScript support - Full type safety with generated TypeScript declarations
  • ⚙️ Configurable - Customize component naming, directories, and SVGR options
  • 🚀 Zero runtime - Icons are transformed at build time

Installation

npm install @appjamstudio/vite-plugin-icon-forge

Usage

1. Configure the plugin

Add the plugin to your vite.config.ts:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import iconForge from '@appjamstudio/vite-plugin-icon-forge'

export default defineConfig({
  plugins: [
    react(),
    iconForge({
      iconsDirectory: 'src/icons', // Default: 'src/icons'
      iconSuffix: 'Icon',          // Default: 'Icon'
      iconPrefix: '',              // Default: ''
    })
  ],
})

2. Organize your SVG files

Place your SVG files in the configured directory with subdirectories for organization:

src/
  icons/
    basic/
      heart.svg
      star.svg
    social/
      github.svg
      twitter.svg

3. Import and use your icons

The plugin automatically generates barrel exports, so you can import icons cleanly:

import { HeartIcon, StarIcon } from './icons/basic'
import { GithubIcon, TwitterIcon } from './icons/social'

function App() {
  return (
    <div>
      <HeartIcon style={{ color: 'red' }} />
      <StarIcon style={{ color: 'gold' }} />
      <GithubIcon style={{ color: '#333' }} />
      <TwitterIcon style={{ color: '#1da1f2' }} />
    </div>
  )
}

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | iconsDirectory | string | 'src/icons' | Directory containing your SVG files | | iconSuffix | string | 'Icon' | Suffix added to component names | | iconPrefix | string | '' | Prefix added to component names | | svgrOptions | Config | undefined | Options passed to SVGR for transformation |

How it works

  1. Scanning: The plugin scans your icons directory for SVG files
  2. Barrel generation: Creates index.ts files in each subdirectory for clean imports
  3. Transformation: Uses SVGR to convert SVGs to React components when imported
  4. Hot reload: Watches for file changes and regenerates barrels automatically

Example Project Structure

my-app/
├── src/
│   ├── icons/
│   │   ├── basic/
│   │   │   ├── heart.svg
│   │   │   ├── star.svg
│   │   │   └── index.ts          # Auto-generated
│   │   └── social/
│   │       ├── github.svg
│   │       ├── twitter.svg
│   │       └── index.ts          # Auto-generated
│   └── App.tsx
├── vite.config.ts
└── package.json

Requirements

  • Vite 3.0+
  • React 16.8+
  • Node.js 16+

Peer Dependencies

  • @svgr/core (optional) - For SVG transformation. The plugin will use a default configuration if not installed.

License

MIT

Contributing

Issues and pull requests are welcome! Please visit our GitHub repository.