Vite plugin (v3.0.1) that generates an SVG spritesheet and optional TypeScript type definitions from a folder of SVG icons. Watches the input directory and rebuilds on changes. Supports multiple spritesheet configurations, custom icon naming via transformer function, and integration with Prettier or Biome for formatting. Respects Vite's assetInlineLimit configuration. Requires Vite >=5.2.0 as a peer dependency. Differentiated by its focus on spritesheet generation with HMR support and framework-agnostic design (React, Vue, Angular, Remix).
npm install vite-plugin-icons-spritesheetVerified import paths — ran on the pinned version, not inferred.
Plugin setup with TypeScript types and React component example using the generated spritesheet.
Remove `formatterConfigPath` from your config. Ensure Prettier or Biome config file is present in the project root.
Update type imports: the type output is now a string union derived from the icon file names. Adjust any icon name literals if they differ.
If you have multiple icon folders, wrap your single config in an array or use multiple separate config objects.
Manually delete `outputDir/sprite.svg` and `typesOutputFile` if you remove icons. Or implement a custom cleanup script.
Use `import { iconsSpritesheet } from 'vite-plugin-icons-spritesheet'` and set `"type": "module"` in package.json or use .mjs file.Upgrade Vite to >=5.2.0: `npm install vite@latest` or adjust plugin to v2.x if Vite downgrade not possible.
Install the package: `npm install -D vite-plugin-icons-spritesheet`. Verify it's in devDependencies.
Change `import iconsSpritesheet from ...` to `import { iconsSpritesheet } from ...`.