{"id":22244,"library":"rollup-plugin-svg-sprite-deterministic","title":"rollup-plugin-svg-sprite-deterministic","description":"A Rollup plugin that creates deterministic external SVG sprite files from imported SVG files, with optimization via SVGO. Current stable version 2.0.0 (Node >=12). This fork of rollup-plugin-svg-sprite ensures repeatable builds by fixing non-deterministic output (e.g., SVG IDs, ordering). Released as needed. Key differentiators: deterministic builds vs original plugin, optional minification, configurable output folder.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mhassan1/rollup-plugin-svg-sprite","tags":["javascript","rollup","rollup-plugin","svg","sprite","svg-sprite","svgo","create","generate"],"install":[{"cmd":"npm install rollup-plugin-svg-sprite-deterministic","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-svg-sprite-deterministic","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-svg-sprite-deterministic","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - requires Rollup to function","package":"rollup","optional":false},{"reason":"used for SVG minification","package":"svgo","optional":true}],"imports":[{"note":"Plugin is ESM-only; CommonJS require() will fail unless using dynamic import or bundler that handles ESM.","wrong":"const svgSprite = require('rollup-plugin-svg-sprite-deterministic')","symbol":"default export","correct":"import svgSprite from 'rollup-plugin-svg-sprite-deterministic'"},{"note":"Version 2.0.0 exports both default and named; using named import requires destructuring correctly.","wrong":"import svgSprite from 'rollup-plugin-svg-sprite-deterministic'","symbol":"named export","correct":"import { svgSprite } from 'rollup-plugin-svg-sprite-deterministic'"},{"note":"Types are not shipped with the package; you must install @types/rollup-plugin-svg-sprite-deterministic if available or declare manually.","wrong":null,"symbol":"TypeScript types","correct":"import type { RollupPluginSvgSpriteOptions } from 'rollup-plugin-svg-sprite-deterministic'"}],"quickstart":{"code":"// rollup.config.js\nimport svgSprite from 'rollup-plugin-svg-sprite-deterministic'\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/app.js',\n    format: 'iife'\n  },\n  plugins: [\n    svgSprite({\n      outputFolder: 'dist/public'\n    })\n  ]\n}\n\n// src/index.js\nimport './svg/trash.svg'\nimport './svg/user.svg'","lang":"javascript","description":"Configures Rollup to create a deterministic SVG sprite from imported SVG files."},"warnings":[{"fix":"Review configuration options and adjust output folder accordingly. If migrating from 1.x, test output sprite names.","message":"Version 2.x changes the default output behavior: sprite file name may differ from 1.x, and options have been reorganized. See pull request #1.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"If you need custom SVGO options, consider using a separate SVGO plugin after sprite generation, or watch for future updates.","message":"The 'minify' option defaults to true but SVGO configuration is not customizable in current version. This may change in future releases.","severity":"deprecated","affected_versions":"<=2.0.0"},{"fix":"Use dynamic import: const svgSprite = (await import('rollup-plugin-svg-sprite-deterministic')).default","message":"Plugin is ESM-only and cannot be required() with CommonJS. Using require() in a Node.js script will throw an error.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Ensure consistent import order, e.g., by explicitly listing files or using a deterministic glob plugin.","message":"SVG sprite output is deterministic only when the same set of SVGs is imported in the same order across builds. If file ordering changes (e.g., due to glob resolution), sprite may differ.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to dynamic import: const svgSprite = (await import('rollup-plugin-svg-sprite-deterministic')).default","cause":"Using CommonJS require() to import an ESM-only module.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Ensure correct import: import svgSprite from 'rollup-plugin-svg-sprite-deterministic'","cause":"Incorrect import pattern (named vs default) or missing parentheses.","error":"TypeError: svgSprite is not a function"},{"fix":"Run npm install rollup-plugin-svg-sprite-deterministic -D","cause":"Package not installed or not in node_modules.","error":"Error: Could not resolve 'rollup-plugin-svg-sprite-deterministic'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}