Registry /
devops / html-webpack-inline-svg-plugin
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HtmlWebpackInlineSVGPlugin
✓ const HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin');
✗ import HtmlWebpackInlineSVGPlugin from 'html-webpack-inline-svg-plugin';
Plugin is CJS-only; no ESM export. Use require() in webpack config file.
HtmlWebpackPlugin
✓ const HtmlWebpackPlugin = require('html-webpack-plugin');
✗ const HtmlWebpackPlugin = require('html-webpack-inline-svg-plugin');
Do not confuse with this plugin; html-webpack-plugin is a separate required dependency.
svgoConfig
✓ new HtmlWebpackInlineSVGPlugin({ svgoConfig: { plugins: ['removeDoctype'] } })
✗ new HtmlWebpackPlugin({ svgoConfig: { ... } })
Breaking change in v2.3.0: svgoConfig must be passed to HtmlWebpackInlineSVGPlugin, not HtmlWebpackPlugin. An error is thrown if placed incorrectly.
Webpack config with html-webpack-plugin and html-webpack-inline-svg-plugin, setting SVGO options and runPreEmit flag.
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin');
module.exports = {
entry: './src/index.js',
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new HtmlWebpackInlineSVGPlugin({
svgoConfig: {
plugins: [
{ name: 'removeViewBox', active: false }
]
},
runPreEmit: false
})
]
};
// In your HTML template:
// <img inline src="icon.svg"> becomes the <svg> content
Errors
Common errors & fixes
Error: HtmlWebpackInlineSVGPlugin: svgoConfig should be passed inside the plugin constructor, not in HtmlWebpackPlugin options.
svgoConfig placed incorrectly in HtmlWebpackPlugin options as per v2.3.0 breaking change.
fixMove svgoConfig to new HtmlWebpackInlineSVGPlugin({ svgoConfig: ... }) and remove from HtmlWebpackPlugin options. Error: Cannot find module 'html-webpack-plugin'
Missing peer dependency html-webpack-plugin.
fixInstall it: npm install --save-dev html-webpack-plugin
Module not found: Error: Can't resolve 'icon.svg'
SVG file path is incorrect or webpack cannot resolve it. Plugin does not resolve paths itself; relies on webpack loaders or absolute/relative paths.
fixUse correct path relative to output directory or configure a loader like file-loader. Ensure runPreEmit is set correctly.
Audit
Dependencies
html-webpack-pluginrequiredcore peer dependency; the plugin hooks into its lifecycle
webpackrequiredbuild tool; required at runtime