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–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SvgStore
✓ const SvgStore = require('webpack-svgstore');
✗ const SvgStore = require('webpack-svgstore').default;
The plugin is exported as a CommonJS module; no default export.
svgxhr
✓ import svgxhr from 'webpack-svgstore/dist/helpers/svgxhr';
✗ import svgxhr from 'webpack-svgstore';
The svgxhr helper is not exported from the package index; it must be imported from the dist/helpers subpath.
SvgStore TypeScript
✓ import SvgStore from 'webpack-svgstore';
✗ const SvgStore = require('webpack-svgstore'); (if using TypeScript with esModuleInterop false)
TypeScript types are bundled; import works with both import and require depending on tsconfig settings.
Shows webpack config with plugin and how to load the sprite in entry code using the svgxhr helper.
const path = require('path');
const SvgStore = require('webpack-svgstore');
module.exports = {
plugins: [
new SvgStore({
path: path.resolve(__dirname, 'assets/svg/**/*.svg'),
fileName: 'svg-sprites.svg',
prefix: 'icon-',
}),
],
};
// In entry module:
import svgxhr from 'webpack-svgstore/dist/helpers/svgxhr';
svgxhr('svg-sprites.svg');
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'webpack-svgstore/dist/helpers/svgxhr'
The svgxhr helper is not in the default export path. Wrong import path used.
fixChange import to: import svgxhr from 'webpack-svgstore/dist/helpers/svgxhr';
TypeError: SvgStore is not a constructor
Importing with default export when package uses CommonJS exports.
fixUse: const SvgStore = require('webpack-svgstore'); ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
Using webpack 5 with plugin but output.filename defined instead of plugin options.
fixMove fileName and path to plugin constructor options.
Audit
Dependencies
webpackrequiredpeer dependency – plugin requires webpack 5