Skip to content
PluginStats

vite-plugin-solid-svg weekly downloads statistics

By jfgodoy · npm · Vite plugins

Import SVG files as Solid.js Components

View on npm Fresh · Dec 6, 2026

vite-plugin-solid-svg has 45,761 recorded weekly downloads on npm, an increase of 115% over the past 30 days, ranking #810 of 3,247 tracked listings.

Weekly downloads
45,761
Official API · Dec 5, 2026
7-day growth
+24.7%
+9.1K weekly downloads
30-day growth
+115%
+24.5K weekly downloads
90-day growth
+178%
+29.3K weekly downloads
Rank
#810
▲ 32 in 7 days

About vite-plugin-solid-svg

<h1 align="center">vite-plugin-solid-svg</h1> <p align="center">Extend Vite with ability to use SVG files as Solid.js components.</p>
Features:
  • SVGO optimization
  • Hot Module Replacement support
  • Support for ?component-solid query string
  • SSR
Currently supported Vite version:
<p><code>4 or above</code></p>
Install
yarn add --dev vite-plugin-solid-svg

pnpm i -D vite-plugin-solid-svg
Setup
// vite.config.js
import solidPlugin from 'vite-plugin-solid'
import solidSvg from 'vite-plugin-solid-svg'
import { defineConfig } from 'vite'

export default defineConfig({
  plugins: [solidPlugin(), solidSvg()],
})
typescript

vite adds its own definition for "*.svg" and defines them as string. As far as I know this cannot be overridden. So we have two options: put our types before those of vite, or use imports with querystring.

If you are using defaultAsComponent which is the default, you need to put our types definition before vite in the tsconfig.

// tsconfig.json
"compilerOptions": {
  "types": [
    "vite-plugin-solid-svg/types-component-solid"
    "vite/client",
  ],
},

if you change to defaultAsComponent=false, you should use a different type definition that only identifies an svg import as a solid component when it matches the querystring. And in this case, put it before "vite/client"

// tsconfig.json
"compilerOptions": {
  "types": [
    "vite-plugin-solid-svg/types",
    "vite/client"
  ],
},
import MyIcon from './my-icon.svg';     // <-- this will match vite module definition, and therefore identified as string
import MyIcon from './my-icon.svg?component-solid';     // <-- this will match the definition in this plugin, and therefore identified as Solid Component
Options
SolidSvg({
  /**
   * If true, will export as JSX component if `as` isn't specified.
   *
   * Otherwise will export as url, or as JSX component if '?as=component-solid'
   *
   */
  defaultAsComponent: true,

  svgo: {
    enabled: true, // optional, by default is true
    svgoConfig: <svgo config>  // optional, if defined, the file svgo.config.js is not loaded.
  }
})

If you need to configure svgo, you can also create a config file svgo.config.js in the project's root, following the instructions at svgo docs. The svgo.svgoConfig has precedence over the file.

Usage

Import as a Solid.js component:

import MyIcon from './my-icon.svg?component-solid';
// or './my-icon.svg' if `defaultAsComponent` is `true`
import MyIcon from './my-icon.svg';

const App = () => {
  return (
    <div>
        <h1> Title </h1>
        <MyIcon />
    </div>
  );
};

export default App;

To import all svg inside a folder, use import.meta.glob('@/svgs/*.svg', { as: 'component-solid' }). See Vite docs for more details.

const icons = import.meta.glob('./*.svg', { as: 'component-solid' })

/*
  icons = {
    icon1: () => import("./icon1.svg"),
    icon2: () => import("./icon2.svg")
  }
*/

const App = () => {
  const Icon1 = lazy(() => iconsDic.icon1())
  return (
    <div>
        <p>hello</p><Icon1 />
    </div>
  );
};

export default App;
Why

In a Solidjs + vite project, you can easily add an svg image using:

import iconUrl from './icon.svg'

const App = () => {
  return (
    <div>
      <img href={iconUrl}>
    </div>
  )
}

However the fill color of the image cannot be overriden. Importing the svg as a component solves this and allows css styles to cascade into the svg content. Furthermore there may be situations where you'll need to ensure the image has been fully loaded, for example, before starting an animation. This module gives you a component that you can control when it's loaded.

Credits

This plugin is based on the work from the following projects:

Description from the npm listing.

  • vite-plugin
  • svg
  • svgo
  • vite
  • solid
  • solidjs

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-solid-svg weekly downloads on npm, last 90 days: 45,761 weekly downloads as of Dec 5, 2026, +178% over 90 days.vite-plugin-solid-svgWeekly downloads on npm · Last 90 days45,761downloads / week+178% over 90 days010K20K30K40K50KSep 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-solid-svg weekly downloads on npm, last 90 days: 45,761 weekly downloads as of Dec 5, 2026, +178% over 90 days.

7/30/90-day growth

vite-plugin-solid-svg weekly downloads growth on npm: +24.7% over 7 days, +115% over 30 days, +178% over 90 days.vite-plugin-solid-svgWeekly downloads growth on npm45,761downloads / week now7-day growth+9,078 weekly downloads+24.7%30-day growth+24,451 weekly downloads+115%90-day growth+29,308 weekly downloads+178%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-solid-svg weekly downloads growth on npm: +24.7% over 7 days, +115% over 30 days, +178% over 90 days.

Ranking history

vite-plugin-solid-svg npm ranking history: currently #810 (by weekly downloads).vite-plugin-solid-svgnpm ranking · by weekly downloads · Last 90 days#810current rank#300#400#500#600#700#800#900#1000#1100Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-solid-svg npm ranking history: currently #810 (by weekly downloads).

Listing placement

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

Listing placement

Vite plugins300 listings · 15 pages · page 8, #1 (overall #141)
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 (591)
Recent weekly downloads observations for vite-plugin-solid-svg
Date (UTC)Weekly downloadsChange vs. previous
45,761+2.6K
43,180+4.3K
38,911+4K
34,881+67
34,814-373
35,187-1.1K
36,313-370
36,683-1.2K
37,931-3.9K
41,794-138
41,932+3.2K
38,742+4.6K
34,093+3.8K
30,331—

Similar npm Vite plugins plugins

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