vite-plugin-fast-react-svg (v0.6.2) transforms SVG files into React components without Babel, using regex and dangerouslySetInnerHTML for near-instant processing. Requires Vite 6.3+/7/8 and React 18 or 19. Key differentiator vs. svgr: no AST/Babel overhead, orders of magnitude faster for large projects. Supports only optimized SVGs (svgo with convertStyleToAttrs). ESM-only since v0.5.0, Node 18+. Ships TypeScript types. Releases follow Vite major updates; breaking changes are infrequent but significant (drop of ?inline, option removal, import changes). Usually released every few months.
npm install vite-plugin-fast-react-svgVerified import paths — ran on the pinned version, not inferred.
Configure Vite plugin, add TypeScript types, then import SVG as React component.
Change `import svgPlugin from 'vite-plugin-fast-react-svg'` to `import { svgPlugin } from 'vite-plugin-fast-react-svg'`.Replace `import { svgToJSX }` with `import { svgToJS }`. Remove `?inline` suffix from imports; Vite 5 core now inlines SVGs.Ensure your project uses ESM (type: module in package.json) and Node 18+.
Upgrade Vite to ^6.3 || ^7 || ^8.
Run SVGs through svgo with convertStyleToAttrs enabled, or manually convert styles to attributes.
Add `"vite-plugin-fast-react-svg/types"` to tsconfig compilerOptions.types.
Remove any options object from `svgPlugin()` call – it takes no arguments.
Add `"vite-plugin-fast-react-svg/types"` to the `types` array in your tsconfig.json compilerOptions.
Either include type augmentation as above, or create a custom .d.ts: `declare module '*.svg' { import type { FC, SVGProps } from 'react'; const SVGComponent: FC<SVGProps<SVGSVGElement>>; export default SVGComponent; }`Ensure import is `import { svgPlugin } from 'vite-plugin-fast-react-svg'`.Run `npm install vite-plugin-fast-react-svg` and use Node 18+.