A Babel plugin (v1.2.0) that transforms SVG imports into inline SVG strings, optimized with SVGO and with optional ID namespacing to avoid conflicts. Supports exporting as data URI for direct use in src attributes. Key differentiators: built-in SVGO optimization, automatic ID namespacing, and data URI export. Alternatives like svg-inline-loader or @svgr/webpack require more configuration.
npm install babel-plugin-inline-svgVerified import paths — ran on the pinned version, not inferred.
Configure babel-plugin-inline-svg to ignore 'icons' files, disable ID namespacing, and export SVG as data URI.
If you need a React component, consider using @svgr/webpack instead.
Update custom transformers that rely on the old argument order.
Only disable if you have pre-optimized SVGs.
Use disableNamespaceIds: true if IDs are not used in CSS.
Add the babel-loader with this plugin before other loaders in webpack config, or use the plugin directly in .babelrc and ensure svg files are not handled by other loaders.
Run 'npm install --save-dev babel-plugin-inline-svg' and verify your .babelrc or babel config.
Use import statement or access .default when using require(). Ensure the file has .svg extension and the plugin is active.