Skip to content
PluginStats

vite-plugin-svg4vue weekly downloads statistics

By yisibell · npm · Vite plugins

A vite plugin which can transform svg icon to vue component, support optimization via SVGO, easy to customize svg color and size.

View on npm Fresh · Dec 6, 2026

vite-plugin-svg4vue has 5,053 recorded weekly downloads on npm, an increase of 40.8% over the past 30 days, ranking #1526 of 3,247 tracked listings.

Weekly downloads
5,053
Official API · Dec 5, 2026
7-day growth
-43.3%
-3.9K weekly downloads
30-day growth
+40.8%
+1.5K weekly downloads
90-day growth
+272%
+3.7K weekly downloads
Rank
#1526
Among tracked npm listings

About vite-plugin-svg4vue

<p align="center"> <a href="https://www.npmjs.org/package/vite-plugin-svg4vue"> <img src="https://img.shields.io/npm/v/vite-plugin-svg4vue.svg"> </a> <a href="https://npmcharts.com/compare/vite-plugin-svg4vue?minimal=true"> <img src="https://img.shields.io/npm/dm/vite-plugin-svg4vue.svg"> </a> <br> </p>

vite-plugin-svg4vue

A vite (5.x || 6.x || 7.x || 8.x) plugin which can transform SVG icon to vue (2.7.X || 3.x) component.

this plugin dependencies on vue/compiler-sfc, so keep your vue version to 3.2.13+ or 2.7.14+.

Features

  • SVGO optimization.
  • Hot Module Replacement support.
  • Support for ?url , ?component and ?raw query string.
  • Support custom svg icon (monochrome) color with fill , fill-opacity , stroke , stroke-opacity attribute.
  • Support change svg icon size with font-size and it will be responsive.
  • Support <a href="https://www.iconfont.cn/" target="_blank">Iconfont SVG Icons</a>.

Installation

# pnpm
$ pnpm add vite-plugin-svg4vue -D

# yarn
$ yarn add vite-plugin-svg4vue --dev

# npm
$ npm i vite-plugin-svg4vue -D

Development

The repository uses pnpm workspaces. The package is at the repository root and the Vue demo is the example workspace.

The root-level scripts are:

ScriptDescription
pnpm devWatch and rebuild the vite-plugin-svg4vue package with Rollup while developing the plugin.
pnpm dev:exampleStart the example Vite development server.
pnpm buildBuild the plugin package and generate JavaScript and TypeScript declaration files in lib/.
pnpm build:exampleBuild the example app with Vite. This runs the production bundler only.
pnpm build:allBuild the plugin, then run the example's complete build script, including type checking and the production build.
pnpm lintCheck the root package with ESLint and eslint-plugin-format without changing files.
pnpm lint:fixCheck and automatically format/fix the root package.
pnpm --filter example lintCheck the example workspace with ESLint and eslint-plugin-format.
pnpm --filter example lint:fixCheck and automatically format/fix the example workspace.
pnpm releaseBuild the package, generate a changelog, publish it to npm, and push release tags. Use only when preparing a release.

For example, run the demo in development mode from the repository root:

pnpm dev:example

This is equivalent to:

pnpm --filter example dev

You can also enter the workspace directory and run its scripts directly:

cd example
pnpm dev
pnpm build

To add a dependency to the demo, run this from the repository root:

pnpm --filter example add <package>
pnpm --filter example add -D <package>

Usage

Setup

// vite.config.ts

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { svg4VuePlugin } from 'vite-plugin-svg4vue'

export default defineConfig({
  plugins: [
    vue(),
    svg4VuePlugin(),
  ],
})

In Vue

<template>
  <div>
    <h2>SVG component: </h2>

    <!-- you can change the svg icon color with `fill` attribute when it's a monochrome icon -->
    <LogoSvg fill="red" />

    <!-- you can change the svg icon size with `font-size` or `width`. both of this will be responsive -->
    <LogoSvg font-size="48" />
    <LogoSvg width="48" />

    <h2>SVG url: </h2>

    <p>
      <img :src="logoSvgUrl" alt="" width="36" />
    </p>

    <h2>SVG raw: </h2>

    <p>
      <span v-html="logoSvgRaw"></span>
    </p>
  </div>
</template>

<script setup lang="ts">
import LogoSvg from '@/icons/logo.svg?component'
import logoSvgUrl from '@/icons/logo.svg?url'
import logoSvgRaw from '@/icons/logo.svg?raw'
</script>

Skip SVGO for a single file (Added in v2.8.1)

SVGO can be explicitly disabled for one file by adding the ?skipsvgo query string:

<template>
  <div class="d-flex align-center mb-16">
    <label class="mr-12"> ?component&skipsvgo: </label>
    <PPTSvg />
  </div>

  <div class="d-flex align-center">
    <label class="mr-12"> ?raw&skipsvgo: </label>
    <span v-html="PPTSvgRaw"></span>
  </div>
</template>

<script setup lang="ts">
import PPTSvg from '@/icons/ppt.svg?component&skipsvgo'
import PPTSvgRaw from '@/icons/ppt.svg?raw&skipsvgo'
</script>

Typescript

If you are using TypeScript, vite-plugin-svg4vue/client can be added to d.ts declaration file.

/// <reference types="vite-plugin-svg4vue/client" />

Options…

Description from the npm listing.

  • vite
  • vite-plugin
  • vue
  • svg
  • svgo
  • svg-component
  • svg-icon
  • icon
  • vite-svg-loader

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-svg4vue weekly downloads on npm, last 90 days: 5,053 weekly downloads as of Dec 5, 2026, +272% over 90 days.vite-plugin-svg4vueWeekly downloads on npm · Last 90 days5,053downloads / week+272% over 90 days02K4K6K8K10K12K14K16KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vite-plugin-svg4vue weekly downloads on npm, last 90 days: 5,053 weekly downloads as of Dec 5, 2026, +272% over 90 days.

7/30/90-day growth

vite-plugin-svg4vue weekly downloads growth on npm: -43.3% over 7 days, +40.8% over 30 days, +272% over 90 days.vite-plugin-svg4vueWeekly downloads growth on npm5,053downloads / week now7-day growth-3,862 weekly downloads-43.3%30-day growth+1,463 weekly downloads+40.8%90-day growth+3,694 weekly downloads+272%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-svg4vue weekly downloads growth on npm: -43.3% over 7 days, +40.8% over 30 days, +272% over 90 days.

Ranking history

vite-plugin-svg4vue npm ranking history: currently #1526 (by weekly downloads).vite-plugin-svg4vuenpm ranking · by weekly downloads · Last 90 days#1526current rank#1200#1250#1300#1350#1400#1450#1500#1550Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankDec 2, 2026 – Dec 6, 2026 · 5 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-svg4vue npm ranking history: currently #1526 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,084 shown · page 77, #6 (overall #1,526)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins300 listings · 15 pages · page 14, #9 (overall #269)
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 (121)
Recent weekly downloads observations for vite-plugin-svg4vue
Date (UTC)Weekly downloadsChange vs. previous
5,053-165
5,218-1.6K
6,834-954
7,788-446
8,234-824
9,058+12
9,046+131
8,915-290
9,205-36
9,241-1.5K
10,694-202
10,896+756
10,140-1.2K
11,343—

Similar npm Vite plugins plugins

All 20 vite-plugin-svg4vue 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-svg4vue. First seen Dec 2, 2026; last successful collection Dec 6, 2026. See the methodology.