{"id":20654,"library":"vite-bundle-analyzer","title":"Vite Bundle Analyzer","description":"A bundle analyzer for Vite, Rollup, and Rolldown that visualizes bundle size with an interactive treemap. Current stable version is 1.3.7. Released actively with multiple updates per month. Differentiators: supports multiple bundlers (Vite, Rollup, Rolldown), multiple output modes (server, static, json, custom), customizable size metrics (stat, gzip, brotli), and TypeScript types included.","status":"active","version":"1.3.7","language":"javascript","source_language":"en","source_url":"https://github.com/nonzzz/vite-bundle-analyzer","tags":["javascript","vite","rollup","rollup-plugin","vite-plugin","visualizer","treemap","bundle-analyzer","rollup-bundle-analyzer","typescript"],"install":[{"cmd":"npm install vite-bundle-analyzer","lang":"bash","label":"npm"},{"cmd":"yarn add vite-bundle-analyzer","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-bundle-analyzer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Vite plugin usage","package":"vite","optional":true},{"reason":"Peer dependency for Rollup plugin usage","package":"rollup","optional":true}],"imports":[{"note":"ESM-only package; CommonJS require will fail.","wrong":"const analyzer = require('vite-bundle-analyzer')","symbol":"analyzer","correct":"import { analyzer } from 'vite-bundle-analyzer'"},{"note":"Only needed when using with Rollup directly.","symbol":"adapter","correct":"import { adapter } from 'vite-bundle-analyzer'"},{"note":"Experimental Rolldown support; API may change.","symbol":"unstableRolldownAdapter","correct":"import { unstableRolldownAdapter } from 'vite-bundle-analyzer'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { analyzer } from 'vite-bundle-analyzer';\n\nexport default defineConfig({\n  plugins: [\n    analyzer({\n      analyzerMode: 'static',\n      fileName: 'report',\n      reportTitle: 'My App Bundle',\n      defaultSizes: 'gzip',\n      openAnalyzer: true,\n    })\n  ]\n});\n// Run: npx vite build --config vite.config.ts","lang":"typescript","description":"Shows how to configure and run the analyzer in static mode with gzip size report."},"warnings":[{"fix":"If you rely on a server, set analyzerPort option.","message":"Static mode now opens HTML reports via file protocol instead of starting a server (since v1.2.3).","severity":"breaking","affected_versions":">=1.2.3"},{"fix":"Monitor releases for stable Rolldown support.","message":"Rolldown plugin is experimental (unstableRolldownAdapter).","severity":"deprecated","affected_versions":">=1.3.0"},{"fix":"Use 'gzip' or 'brotli' as defaultSizes for more realistic sizes.","message":"Vite enables minification by default; parsed size may appear larger than actual size.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you run npx vite build to generate analysis.","message":"Plugin only works during build phase, not dev server.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install vite-bundle-analyzer --save-dev' in your project.","cause":"Installed as devDependency but not installed globally or in node_modules.","error":"Cannot find module 'vite-bundle-analyzer'"},{"fix":"Use import syntax or set type:'module' in package.json.","cause":"Using CommonJS require or running Node in non-ESM mode.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Remove plugin from dev server config or run 'npx vite build'.","cause":"Used analyzer plugin in dev server or without build.","error":"Error: Plugin is only applicable during the build phase"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}