svgr VS vite-plugin-svgr

Compare svgr vs vite-plugin-svgr and see what are their differences.

Our great sponsors
  • Appwrite - The open-source backend cloud platform
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Onboard AI - Learn any GitHub repo in 59 seconds
svgr vite-plugin-svgr
30 4
10,089 413
- -
7.3 7.8
19 days ago 24 days ago
TypeScript TypeScript
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.


Posts with mentions or reviews of svgr. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-06-27.
  • Nx + NextJS + Docker - The Nx way: Creating the NextJS application
    6 projects | | 27 Jun 2023
    //@ts-check // eslint-disable-next-line @typescript-eslint/no-var-requires const { composePlugins, withNx } = require('@nx/next'); /** * @type {import('@nx/next/plugins/with-nx').WithNxOptions} **/ const nextConfig = { nx: { // Set this to true if you would like to use SVGR // See: svgr: false, }, }; const plugins = [ // Add more Next.js plugins to this list if needed. withNx, ]; module.exports = composePlugins(...plugins)(nextConfig);
  • How do I use SVG icons in React?
    2 projects | /r/Frontend | 8 Apr 2023
  • One way of building an SVG icon library for your project
    2 projects | /r/javascript | 20 Jan 2023
    Really interesting framework agnostic approach, but I think SVGR is a better option for my React homies. It imports an SVG file as a React component. Shouts also to react-icons if Font Awesome, Material Icons and friends are more your bag.
  • Alternative libs to migrate from React to Vue (or Vue to React)
    12 projects | | 5 Jan 2023
  • Power up SVGs with React and CSS
    3 projects | | 4 Dec 2022
    There is another way to import an SVG in Create React App, though. We can import the SVG as a ReactComponent. This is because CRA leverages SVGR to process SVGs.
  • Создаем React-компоненты иконок с помощью Figma API и SVGR. Часть 2.
    6 projects | | 16 Nov 2022
    const { types } = require('@babel/core'); module.exports = { ... template: function svgrCustomTemplate( { imports, interfaces, componentName, props, jsx, exports }, { tpl } ) { // меняем корневой элемент на SvgIcon = 'SvgIcon'; = 'SvgIcon'; // // при изменении корневого элемента пропадает спред пропсов // поэтому необходимо добавить спред пропсов самостоятельно jsx.openingElement.attributes.push( types.jSXSpreadAttribute(types.identifier('props')) ); return tpl` ${imports}; import { SvgIcon } from '../SvgIcon'; ${interfaces}; const ${componentName} = (${props}) => ( ${jsx} ); ${exports}; ` } }
  • Using SVGs in Common Lisp web apps with Djula
    8 projects | | 8 Aug 2022
    To solve these problems and have a better development workflow, I have created a package called cl-djula-svg which automates all the above steps for you. The inspiration for this package came from svgr which exactly does the same thing in React applications. It takes a SVG file, process some override logic, optimize it and create React wrapper components based on the SVG content.
  • Some svg icons wont show with react native svg
    3 projects | /r/reactnative | 12 Jun 2022
    I normally use SVGR but every time a designer sends me an svg i’ll pass it in svgOmg that deletes all the unnecessary attributes and propietary code from figma, illustrator &co.
  • External SVGs that you can style
    2 projects | | 11 Apr 2022
  • How to debug from this error statement
    4 projects | /r/learnjavascript | 26 Mar 2022 this may help as well.


Posts with mentions or reviews of vite-plugin-svgr. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-05-09.
  • Chrome Extension with React + CRXJS + Vite + Docker
    3 projects | | 9 May 2023
    If you want to use svg with React components, install vite-plugin-svgr.
  • Migrating from Create React App (CRA) to Vite
    6 projects | | 22 Aug 2022
    We need vite-plugin-svgr in order to import SVGs as React components. For example:
  • Repeating variable names for imports, types and switch. Got to be a better way!
    3 projects | /r/reactjs | 25 Feb 2022
    If you're using Vite, then maybe try one of these: - -
  • Using Vite with React
    18 projects | | 3 Apr 2021
    Instead of webpack svgr - vite has a community plugin vite-plugin-svgr. Looking at its source code I can tell that it does the work as needed. In the future, I may want to add more SVGR options (currently for custom colors we use css currentColor property), so I may contribute it or create a similar plugin. NOTE: vite bundles the static svg in addition to assets even if you use vite-plugin-svgr. So many useless files will be generated. This is a minor issue that can be unnoticeable. I created a script for deleting those files (it has 0 impacts on the bundle because the client does not download those chunks).

What are some alternatives?

When comparing svgr and vite-plugin-svgr you can also consider the following projects:

webpack-bundle-analyzer - Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap

svg-sprite-loader - Webpack loader for creating SVG sprites.

svgo - ⚙️ Node.js tool for optimizing SVG files

esbuild - An extremely fast bundler for the web

vite-plugin-svg-icons - Vite Plugin for fast creating SVG sprites.

react-markdown - Markdown component for React

raw-loader - A loader for webpack that allows importing files as a String

awesome-vite - ⚡️ A curated list of awesome things related to Vite.js

rollup-plugin-visualizer - 📈⚖️ Visuallize your bundle

blog-series-nextjs-nx - Source code for the Next.js + Nx blog series

Konva - Konva.js is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.