Import SVG files as base64 data URIs or as raw SVG markup in Rollup bundles. Current stable version 2.0.0. Maintenance mode; no recent updates. Key differentiator: lightweight, zero-config plugin for SVG imports with optional base64 encoding. Simple API: just add to plugins array and import SVGs like JavaScript modules. Alternatives: @rollup/plugin-image, rollup-plugin-url, but this plugin remains a straightforward choice for SVG-only usage.
npm install rollup-plugin-svgVerified import paths — ran on the pinned version, not inferred.
Basic setup: import SVG as raw markup (default) and use in DOM.
Set base64: true in plugin options if you relied on base64 output.
Consider switching to @rollup/plugin-image or rollup-plugin-url for continued support.
Ensure import statements include .svg extension: import logo from './logo.svg'
Use appropriate plugins for other bundlers (e.g., webpack's url-loader).
Run npm i -D rollup-plugin-svg and ensure import line is correct: import svg from 'rollup-plugin-svg'
Change import to: import svg from 'rollup-plugin-svg' (remove curly braces).
Add svg() to plugins array in rollup.config.js.