Skip to content
PluginStats

vite-plugin-svg-icons weekly downloads statistics

By anncwb (3 listings) · npm · Vite plugins

Vite Plugin for fast creating SVG sprites.

View on npm Fresh · Oct 18, 2026

vite-plugin-svg-icons has 40,716 recorded weekly downloads on npm, a decrease of 37.7% over the past 30 days, ranking #633 of 2,322 tracked listings.

Weekly downloads
40,716
Official API · Oct 18, 2026
7-day growth
-36.8%
-23.7K weekly downloads
30-day growth
-37.7%
-24.6K weekly downloads
90-day growth
-48.9%
-38.9K weekly downloads
Rank
#633
Among tracked npm listings

About vite-plugin-svg-icons

vite-plugin-svg-icons

English | 中文

Used to generate svg sprite map.

Feature

  • Preloading All icons are generated when the project is running, and you only need to operate dom once.
  • High performance Built-in cache, it will be regenerated only when the file is modified.

Installation (yarn or npm)

node version: >=12.0.0

vite version: >=2.0.0

yarn add vite-plugin-svg-icons -D

or

npm i vite-plugin-svg-icons -D

Usage

  • Configuration plugin in vite.config.ts
import viteSvgIcons from 'vite-plugin-svg-icons';
import path from 'path';

export default () => {
  return {
    plugins: [
      viteSvgIcons({
        // Specify the icon folder to be cached
        iconDirs: [path.resolve(process.cwd(), 'src/icons')],
        // Specify symbolId format
        symbolId: 'icon-[dir]-[name]',
      }),
    ],
  };
};
  • Introduce the registration script in src/main.ts
import 'virtual:svg-icons-register';

Here the svg sprite map has been generated

How to use in components

Vue way

/src/components/SvgIcon.vue

<template>
  <svg aria-hidden="true">
    <use :href="symbolId" :fill="color" />
  </svg>
</template>

<script>
  import { defineComponent, computed } from 'vue';

  export default defineComponent({
    name: 'SvgIcon',
    props: {
      prefix: {
        type: String,
        default: 'icon',
      },
      name: {
        type: String,
        required: true,
      },
      color: {
        type: String,
        default: '#333',
      },
    },
    setup(props) {
      const symbolId = computed(() => `#${props.prefix}-${props.name}`);
      return { symbolId };
    },
  });
</script>
Icons Directory Structure
# src/icons

- icon1.svg
- icon2.svg
- icon3.svg
- dir/icon1.svg

/src/App.vue

<template>
  <div>
    <SvgIcon name="icon1"></SvgIcon>
    <SvgIcon name="icon2"></SvgIcon>
    <SvgIcon name="icon3"></SvgIcon>
    <SvgIcon name="dir-icon1"></SvgIcon>
  </div>
</template>

<script>
  import { defineComponent, computed } from 'vue';

  import SvgIcon from './components/SvgIcon.vue';
  export default defineComponent({
    name: 'App',
    components: { SvgIcon },
  });
</script>
React way

/src/components/SvgIcon.jsx

export default function SvgIcon({ name, prefix = 'icon', color = '#333', ...props }) {
  const symbolId = `#${prefix}-${name}`;

  return (
    <svg {...props} aria-hidden="true">
      <use href={symbolId} fill={color} />
    </svg>
  );
}
Icons Directory Structure
# src/icons

- icon1.svg
- icon2.svg
- icon3.svg
- dir/icon1.svg

/src/App.jsx

import SvgIcon from './components/SvgIcon';

export default function App() {
  return (
    <>
      <SvgIcon name="icon1"></SvgIcon>
      <SvgIcon name="icon1"></SvgIcon>
      <SvgIcon name="icon1"></SvgIcon>
      <SvgIcon name="dir-icon1"></SvgIcon>
    </>
  );
}
Get all SymbolId
import ids from 'virtual:svg-icons-names';
// => ['icon-icon1','icon-icon2','icon-icon3']
Options
ParameterTypeDefaultDescription
iconDirsstring[]-Need to generate the icon folder of the Sprite image
symbolIdstringicon-[dir]-[name]svg symbolId format, see the description below
svgoOptionsboolean|SvgoOptionstruesvg compression configuration, can be an objectOptions

symbolId

icon-[dir]-[name]

[name]:

svg file name

[dir]

The svg of the plug-in will not generate hash to distinguish, but distinguish it by folder.

If the folder corresponding to iconDirs contains this other folder

example:

Then the generated SymbolId is written in the comment

# src/icons
- icon1.svg # icon-icon1
- icon2.svg # icon-icon2
- icon3.svg # icon-icon3
- dir/icon1.svg # icon-dir-icon1
- dir/dir2/icon1.svg # icon-dir-dir2-icon1

Note

Although the use of folders to distinguish between them can largely avoid the problem of duplicate names, there will also be svgs with multiple folders and the same file name in iconDirs.

This needs to be avoided by the developer himself

Example

Run


cd ./example

yarn install

yarn dev

Sample project

Vben Admin

License

MIT © Vben-2020

Description from the npm listing.

  • vite
  • vite-plugin
  • svg
  • sprite
  • svgo
  • vben

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vite-plugin-svg-icons weekly downloads on npm, last 90 days: 40,716 weekly downloads as of Oct 18, 2026, -48.9% over 90 days.vite-plugin-svg-iconsWeekly downloads on npm · Last 90 days40,716downloads / week-48.9% over 90 days30K40K50K60K70K80K90KJul 20Aug 4Aug 19Sep 3Sep 18Oct 3Oct 18downloads / weekobservedarchived (Internet Archive)no observationsJul 22, 2026 – Oct 18, 2026 · 89 observations · Updated Oc…pluginstats.com
vite-plugin-svg-icons weekly downloads on npm, last 90 days: 40,716 weekly downloads as of Oct 18, 2026, -48.9% over 90 days.

7/30/90-day growth

vite-plugin-svg-icons weekly downloads growth on npm: -36.8% over 7 days, -37.7% over 30 days, -48.9% over 90 days.vite-plugin-svg-iconsWeekly downloads growth on npm40,716downloads / week now7-day growth-23,720 weekly downloads-36.8%30-day growth-24,621 weekly downloads-37.7%90-day growth-38,922 weekly downloads-48.9%Growth vs. nearest observation to each baseline date · Updated Oct 18, 2026pluginstats.com
vite-plugin-svg-icons weekly downloads growth on npm: -36.8% over 7 days, -37.7% over 30 days, -48.9% over 90 days.

Ranking history

vite-plugin-svg-icons npm ranking history: currently #633 (by weekly downloads).vite-plugin-svg-iconsnpm ranking · by weekly downloads · Last 90 days#633current rank#624#626#628#630#632#634#636Jul 22Aug 6Aug 21Sep 5Sep 20Oct 5Oct 20rankOct 18, 2026 – Oct 20, 2026 · 3 observations · Updated Oct 18, 2026pluginstats.com
vite-plugin-svg-icons npm ranking history: currently #633 (by weekly downloads).

Listing placement

All npm2,320 listings · 116 pages · 1,161 shown · page 32, #13 (overall #633)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins253 listings · 13 pages · page 5, #20 (overall #100)
Vite plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (122)
Recent weekly downloads observations for vite-plugin-svg-icons
Date (UTC)Weekly downloadsChange vs. previous
40,716+4.9K
35,864-9.3K
45,171+167
45,004-14.5K
59,528-11.1K
70,6630
70,663+6.2K
64,436+2.3K
62,126+6K
56,156+6.5K
49,692+4.8K
44,856-1.8K
46,608-13.7K
60,342—

Similar npm Vite plugins plugins

All 20 vite-plugin-svg-icons alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vite-plugin-svg-icons. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.