vite-plugin-react-rich-svg weekly downloads statistics
By iGoodie · npm · Vite plugins
Seamless SVG loader with versatile import options! (Such as React component, dataURI and raw html code)
vite-plugin-react-rich-svg has 14,453 recorded weekly downloads on npm, a decrease of 67.3% over the past 30 days, ranking #1149 of 3,247 tracked listings.
About vite-plugin-react-rich-svg
Description
A vite plugin that handles SVG loading with zero-config effort.
It handles loading raw (html string), inline data uri (data:svg+xml,...) and SVGR Component (with easily usable SVGO options) imports easily!
This plugin is heavily inspired by vite-svg-loader, which is an SVG loading Vite plugin for Vue. It is one of my favourites. Thanks to everyone contributed to it! 💜
How to use?
- Use your favorite package manager to install as dependency
npm install vite-plugin-react-rich-svg --save-dev
- Include it in your
vite.config.ts
import richSvg from "vite-plugin-react-rich-svg";
export default defineConfig({
plugins: [react(), richSvg()],
});
- If you're using Typescript, you might want to include the typings under
vite-env.d.ts:
// Caveat: referencing our plugin first will ensure vite types do not overlap
/// <reference types="vite-plugin-react-rich-svg/client" />
/// <reference types="vite/client" />
- Start importing your SVGs! Happy coding!
// Raw string import
import viteLogoRaw from "./assets/vite.svg?raw";
// Data URL import
import viteLogoDataURL from "./assets/vite.svg?url";
// Base64 Encoded import
import viteLogoBase64 from "./assets/vite.svg?base64";
// SVGR Component import
import ViteLogoComponent from "./assets/vite.svg?component";
// Default import, not handled by our plugin
import viteLogo from "./assets/vite.svg";
Plugin Configurations
include option
Acts as a whitelist predicate for the files you want to be processed.
richSvg({
include: (path) => /.*\.icon\.svg$/.test(path),
// ^ This config will only process files that look like:
// ...chevron-right.icon.svg?raw
// ...chevron-left.icon.svg?component
// ...home.icon.svg?url
}),
exclude option
Acts as a blacklist predicate for the files you want to be ignored.
richSvg({
exclude: (path) => /.*\.ignore\.svg$/.test(path),
// ^ This config will ignore files that look like:
// ...my-illustration.ignore.svg?raw
// ...my-illustration.ignore.svg?component
// ...my-illustration.ignore.svg?url
}),
componentLoaderOptions option
-
svgrConfig= Options used while running SVGR on the original svg code/asset (See SVGR Options) -
oxcConfig= Options passed to Vite's Oxc transform when generating JavaScript from the SVGR output (See Vite'stransformWithOxcAPI)
richSvg({
componentLoaderOptions: {
svgrConfig: {
ref: true,
memo: true,
},
// ^ This config will make it load component svg imports loads with forwardedRef & memo wrapped
oxcConfig: {
jsx: {
runtime: "automatic",
},
},
// ^ These options are passed to Oxc after SVGR generates the component code
},
}),
rawLoaderOptions option
-
svgoEnabled= Enables SVGO optimizations -
svgoConfig= Options used while running SVGO optimizations on the original SVG asset (See SVGO Options)
richSvg({
rawLoaderOptions: {
svgoEnabled: true,
svgoConfig: {},
},
}),
base64LoaderOptions option
-
svgoEnabled= Enables SVGO optimizations -
svgoConfig= Options used while running SVGO optimizations on the original SVG asset (See SVGO Options)
richSvg({
base64LoaderOptions: {
svgoEnabled: true,
svgoConfig: {},
},
}),
urlLoaderOptions option…
Description from the npm listing.
- vite-plugin
- react
- svg
- svgr
- rich
- import
- prettier
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
7/30/90-day growth
Ranking history
Listing placement
Listing placement
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)Similar npm Vite plugins plugins
All 20 vite-plugin-react-rich-svg alternativesData 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-react-rich-svg. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.