Rollup plugin that converts SVG files to JSX components using svg-to-jsx. Current stable version is 1.0.0, released as a minimal wrapper with include/exclude filtering. It transforms SVG imports into React functional components that accept props. The plugin is a simple glue between Rollup and the svg-to-jsx library, with no additional features or active development. Alternatives like @svgr/rollup offer more customization and maintenance.
npm install rollup-plugin-svg-to-jsxVerified import paths — ran on the pinned version, not inferred.
Rollup config that converts imported SVGs to React JSX components using the plugin with include/exclude filters.
Add '@rollup/plugin-commonjs' or use 'react' as external in rollup config if not bundling React.
If using Preact or another JSX library, add a pragma or configure via Babel/Macros.
Migrate to @svgr/rollup (npm install @svgr/rollup) which offers options like icon, SVGO, and TypeScript support.
Add the plugin to rollup.config.js plugins array.
Ensure React is either bundled (via external: ['react']) or imported in the entry point.
Run 'npm install rollup-plugin-svg-to-jsx' or 'yarn add rollup-plugin-svg-to-jsx'.