{"id":22189,"library":"rollup-plugin-purge-icons","title":"rollup-plugin-purge-icons","description":"Rollup plugin for PurgeIcons, a tool that removes unused icon imports from icon libraries (e.g., Material Design, Font Awesome) to reduce bundle size. Version 0.10.0 is current stable; maintained by Anthony Fu. It works by analyzing your source code for used icon names and tree-shaking the rest. Key differentiators: automatic detection of icon usage, supports multiple icon sets, and integrates as a rollup plugin with zero configuration options needed in many cases. Requires @purge-icons/core and @purge-icons/generated as peer dependencies.","status":"active","version":"0.10.0","language":"javascript","source_language":"en","source_url":"https://github.com/antfu/purge-icons","tags":["javascript","rollup-plugin","purge-icons","typescript"],"install":[{"cmd":"npm install rollup-plugin-purge-icons","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-purge-icons","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-purge-icons","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library that provides PurgeIcons functionality","package":"@purge-icons/core","optional":false},{"reason":"Generated icon collection that must be imported in the entry file","package":"@purge-icons/generated","optional":false}],"imports":[{"note":"This package is ESM-only and does not support CommonJS require. Use import statement.","wrong":"const PurgeIcons = require('rollup-plugin-purge-icons')","symbol":"default","correct":"import PurgeIcons from 'rollup-plugin-purge-icons'"},{"note":"This import is a side-effect import that registers the icons. It has no named exports.","wrong":"import { generated } from '@purge-icons/generated'","symbol":"@purge-icons/generated","correct":"import '@purge-icons/generated'"},{"note":"TypeScript type for plugin options. Available for type-checking.","wrong":"","symbol":"PurgeIconsOptions","correct":"import type { PurgeIconsOptions } from 'rollup-plugin-purge-icons'"}],"quickstart":{"code":"import PurgeIcons from 'rollup-plugin-purge-icons';\nimport '@purge-icons/generated';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    PurgeIcons()\n  ]\n};","lang":"typescript","description":"Minimal rollup config using PurgeIcons plugin with default options."},"warnings":[{"fix":"Ensure the import is present in your entry file and not tree-shaken away.","message":"Import '@purge-icons/generated' must be in the entry file after the plugin is applied","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"Use import syntax. If you need CommonJS, consider using dynamic import() or transpile.","message":"The plugin is ESM-only; require() will fail","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Upgrade to Node >=14 for future compatibility.","message":"Node 12 support may be removed in future versions","severity":"deprecated","affected_versions":">=0.10.0"},{"fix":"Install them as devDependencies: npm i @purge-icons/core @purge-icons/generated -D","message":"The plugin does not automatically install @purge-icons/core and @purge-icons/generated","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import syntax or set type: 'module' in package.json.","cause":"Trying to require() an ESM-only package in a CommonJS context.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Run npm install @purge-icons/generated --save-dev","cause":"@purge-icons/generated is not installed.","error":"Module not found: Can't resolve '@purge-icons/generated' in '/path/to/project'"},{"fix":"Switch to export default or named exports syntax.","cause":"Using module.exports in an ES module file.","error":"ReferenceError: exports is not defined in ES module scope"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}