{"id":13606591,"url":"https://github.com/nonzzz/vite-bundle-analyzer","last_synced_at":"2026-02-03T02:10:28.243Z","repository":{"id":200099004,"uuid":"671854890","full_name":"nonzzz/vite-bundle-analyzer","owner":"nonzzz","description":"bundle analyzer for vite","archived":false,"fork":false,"pushed_at":"2025-04-29T09:51:34.000Z","size":20944,"stargazers_count":248,"open_issues_count":1,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-29T10:22:01.590Z","etag":null,"topics":["analyzer","bundle-analyzer","rollup-plugin","visualizer","vite-plugin"],"latest_commit_sha":null,"homepage":"https://nonzzz.github.io/vite-bundle-analyzer/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nonzzz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-07-28T09:44:06.000Z","updated_at":"2025-04-29T09:51:38.000Z","dependencies_parsed_at":"2023-10-15T18:46:15.382Z","dependency_job_id":"51db679e-f3e8-4be1-8bcd-19792f1e5e08","html_url":"https://github.com/nonzzz/vite-bundle-analyzer","commit_stats":{"total_commits":121,"total_committers":8,"mean_commits":15.125,"dds":0.0826446280991735,"last_synced_commit":"888baaa1d05c00dbfb46117fb9237b867204a03a"},"previous_names":["nonzzz/vite-plugin-analyzer","nonzzz/vite-bundle-analyzer"],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonzzz%2Fvite-bundle-analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonzzz%2Fvite-bundle-analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonzzz%2Fvite-bundle-analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nonzzz%2Fvite-bundle-analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nonzzz","download_url":"https://codeload.github.com/nonzzz/vite-bundle-analyzer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253900944,"owners_count":21981282,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analyzer","bundle-analyzer","rollup-plugin","visualizer","vite-plugin"],"created_at":"2024-08-01T19:01:10.492Z","updated_at":"2026-02-03T02:10:28.237Z","avatar_url":"https://github.com/nonzzz.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Plugins"],"sub_categories":["Framework-agnostic Plugins"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://socialify.git.ci/nonzzz/vite-bundle-analyzer/image?font=KoHo\u0026language=1\u0026logo=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F65625612%3Fs%3D200%26v%3D4\u0026name=1\u0026owner=1\u0026pattern=Circuit%20Board\u0026theme=Auto\" alt=\"vite-bundle-analyzer\" width=\"640\" height=\"320\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.com/package/vite-bundle-analyzer\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/vite-bundle-analyzer.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://npmjs.com/package/vite-bundle-analyzer\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dm/vite-bundle-analyzer.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href='https://github.com/sindresorhus/awesome'\u003e\n    \u003cimg src='https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg' alt='Awesome'\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://cdn.jsdelivr.net/gh/nonzzz/vite-bundle-analyzer@latest/imgs/now.gif\" width=\"640\" height=\"320\" /\u003e\n\u003c/p\u003e\n\n# Vite Bundle Analyzer\n\nA bundle analyzer for Vite, Rollup, and Rolldown that visualizes bundle size with an interactive treemap.\n\n\u003e [!WARNING]\n\u003e Vite enables minification by default. The parsed size may appear larger than actual size because bundle info from Rollup isn't compressed. Rolldown support is experimental.\n\n## Installation\n\n```bash\nnpm install vite-bundle-analyzer -D\n# or\nyarn add vite-bundle-analyzer -D\n# or\npnpm add vite-bundle-analyzer -D\n```\n\n## Usage\n\nPlugins only work during the build phase.\n\n### Vite\n\n```js\nimport { defineConfig } from 'vite'\nimport { analyzer } from 'vite-bundle-analyzer'\n\nexport default defineConfig({\n  plugins: [\n    analyzer()\n  ]\n})\n```\n\n### Rollup\n\n```js\nimport { adapter } from 'vite-bundle-analyzer'\nimport { analyzer } from 'vite-bundle-analyzer'\n\nexport default {\n  plugins: [\n    adapter(analyzer())\n  ]\n}\n```\n\n### Rolldown Plugin (Experimental)\n\n```js\nimport { unstableRolldownAdapter } from 'vite-bundle-analyzer'\nimport { analyzer } from 'vite-bundle-analyzer'\n\nexport default {\n  plugins: [\n    unstableRolldownAdapter(analyzer())\n  ]\n}\n```\n\n## Configuration\n\n| Option          | Type                                          | Default                  | Description                                 |\n| --------------- | --------------------------------------------- | ------------------------ | ------------------------------------------- |\n| `analyzerMode`  | `'server' \\| 'static' \\| 'json' \\| function`  | `'server'`               | Analysis output mode                        |\n| `fileName`      | `string \\| function`                          | `'stats'`                | Output filename (without extension)         |\n| `reportTitle`   | `string`                                      | `'Vite Bundle Analyzer'` | Report page title                           |\n| `gzipOptions`   | `Record\u003cstring, any\u003e`                         | `{}`                     | Gzip compression options (see zlib module)  |\n| `brotliOptions` | `Record\u003cstring, any\u003e`                         | `{}`                     | Brotli compression options                  |\n| `analyzerPort`  | `number \\| 'auto'`                            | `8888`                   | Server port                                 |\n| `openAnalyzer`  | `boolean`                                     | `true`                   | Auto-open browser (server/static mode only) |\n| `defaultSizes`  | `'stat' \\| 'gzip' \\| 'brotli'`                | `'stat'`                 | Default size metric                         |\n| `summary`       | `boolean`                                     | `true`                   | Show summary in console                     |\n| `enabled`       | `boolean`                                     | `true`                   | Enable/disable plugin                       |\n| `include`       | `string \\| RegExp \\| Array\u003cstring \\| RegExp\u003e` | `[]`                     | Include patterns                            |\n| `exclude`       | `string \\| RegExp \\| Array\u003cstring \\| RegExp\u003e` | `[]`                     | Exclude patterns                            |\n| `pathFormatter` | `(path: string, defaultWd: string) =\u003e string` | `undefined`              | Formatting Paths                            |\n\n## CLI\n\n```bash\nnpx vite-bundle-analyzer\n\n# With options\nnpx vite-bundle-analyzer --help\n\n# If you're using rolldown-vite pls using the following command\n\nnpx vite-bundle-analyzer -e=rolldown-vite\n```\n\n## Common Issues\n\n### Empty Chunk Sizes\n\nIf chunk sizes appear empty, check for plugins that break source maps (e.g., `@vitejs/plugin-legacy`). The analyzer relies on source maps for accurate size calculation.\n\n### Vite-based Frameworks\n\nFor frameworks built on Vite (VitePress, Remix, Qwik), use `analyzerMode: 'server'` for accurate results due to multiple build instances.\n\n### Static Mode Without Server\n\nWhen `analyzerMode: 'static'` and `openAnalyzer: false`, no development server is created.\n\n## API Integration\n\n```ts\nimport { SSE, createServer, injectHTMLTag, openBrowser, renderView } from 'vite-bundle-analyzer'\n\n// Create custom server\nconst server = createServer()\nserver.get('/', async (c) =\u003e {\n  const html = await renderView(data, { title: 'Custom Analyzer', mode: 'stat' })\n  c.res.writeHead(200, { 'Content-Type': 'text/html' })\n  c.res.write(html)\n  c.res.end()\n})\nserver.listen(3000)\n```\n\n## Debug\n\n```bash\n# Vite\nvite build --debug\n\n# Environment variable\nANALYZE_DEBUG=true npm run build\n```\n\n## Related\n\n- [ROLLDOWN](./ROLLDOWN.md)\n- [Q\u0026A](./Q\u0026A.md)\n- [CHANGELOG](./CHANGELOG.md)\n\n## Contributors\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/nonzzz\"\u003e\n    \u003cimg src=\"https://avatars.githubusercontent.com/u/52351095?v=4\u0026s=40\" width=\"40\" height=\"40\" alt=\"Kanno\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/a3mitskevich\"\u003e\n    \u003cimg src=\"https://avatars.githubusercontent.com/u/77048647?v=4\u0026s=40\" width=\"40\" height=\"40\" alt=\"Aleksandr Mitskevich\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/mengdaoshizhongxinyang\"\u003e\n    \u003cimg src=\"https://avatars.githubusercontent.com/u/37317008?v=4\" width=\"40\" height=\"40\" alt=\"mengdaoshizhongxinyang\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cdn.jsdelivr.net/gh/nonzzz/sponsors/sponsorkit/sponsors.svg\"\u003e\n    \u003cimg src=\"https://cdn.jsdelivr.net/gh/nonzzz/sponsors/sponsorkit/sponsors.svg\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Credits\n\n- [Geist UI](https://github.com/geist-org/geist-ui)\n- The friend who proposed this idea.\n- All contributors and sponsors\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonzzz%2Fvite-bundle-analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnonzzz%2Fvite-bundle-analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnonzzz%2Fvite-bundle-analyzer/lists"}