esbuild-svg 1.0.3 is an esbuild plugin that transforms SVG files into JSX React components using SVGR under the hood. It supports both default and named exports, configurable SVGO optimization, and provides a publicPath feature via a special import suffix. Currently stable, it releases occasionally. Compared to alternatives like @svgr/webpack or vite-plugin-svgr, it is tailored specifically for esbuild and integrates tightly with its publicPath configuration. It ships TypeScript definitions and requires React (peer dependency) for JSX rendering.
npm install esbuild-svgNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures esbuild with the SVG plugin to transform SVG imports into React components using default SVGR settings.
Install react: npm install react
Set svgPlugin({ exportType: 'default' }) to restore old behavior, or update imports to use { ReactComponent } named import.Ensure esbuild build options include publicPath: '/assets/' (or similar).
Run npm install --save-dev esbuild-svg
Use import svgPlugin from 'esbuild-svg' or const { default: svgPlugin } = require('esbuild-svg')Install react: npm install react
Ensure esbuild's loader is set for .jsx/.tsx files, or use esbuild's JSX automatic runtime.