Webpack plugin that generates SVG sprites (SVG store) from a set of SVG files. Version 4.1.0 is the latest stable release. Use v3.x for Webpack 1.x and v4.x for Webpack 2.x. It integrates svgo for optimization, supports prefixing for icon IDs, and includes an optional built-in AJAX sprite loader. Key differentiator: it uses magic variables like `__svg__` in source files to declare input glob and output filename, which can be confusing for newcomers.
npm install webpack-svgstore-pluginVerified import paths — ran on the pinned version, not inferred.
Shows how to configure the plugin in webpack config, declare the sprite definition in source, and use the sprite in HTML.
Install webpack-svgstore-plugin@3.x if using Webpack 1.x, or @4.x for Webpack 2.x.
Ensure the variable is declared and not tree-shaken. Use the exact pattern shown in docs.
Upgrade Node.js to version 4.0+ (recommended 7.0+).
Add `require('webpack-svgstore-plugin/src/helpers/svgxhr')(__svg__);` in your entry file.Use `[hash]` as documented; ensure output path is correct.
Run `npm install webpack-svgstore-plugin --save-dev` and use `require('webpack-svgstore-plugin')`.Replace `import SvgStore from 'webpack-svgstore-plugin'` with `const SvgStore = require('webpack-svgstore-plugin')`.Match versions: `npm install webpack-svgstore-plugin@3 --save-dev` for webpack 1.x, or `@4` for webpack 2.x.