Registry / devops / vite-bundle-analyzer

vite-bundle-analyzer

JSON →
library1.3.7jsnpmunverified

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.

npm install vite-bundle-analyzer
INSTALL
IMPORT
SIG · VITE-BUNDLE-ANALYZ
V
vite-bundle-analyzer
devopsjavascriptv1.3.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

analyzer
import { analyzer } from 'vite-bundle-analyzer'
const analyzer = require('vite-bundle-analyzer')
ESM-only package; CommonJS require will fail.
adapter
import { adapter } from 'vite-bundle-analyzer'
Only needed when using with Rollup directly.
unstableRolldownAdapter
import { unstableRolldownAdapter } from 'vite-bundle-analyzer'
Experimental Rolldown support; API may change.

Shows how to configure and run the analyzer in static mode with gzip size report.

// vite.config.ts import { defineConfig } from 'vite'; import { analyzer } from 'vite-bundle-analyzer'; export default defineConfig({ plugins: [ analyzer({ analyzerMode: 'static', fileName: 'report', reportTitle: 'My App Bundle', defaultSizes: 'gzip', openAnalyzer: true, }) ] }); // Run: npx vite build --config vite.config.ts
Debug
Known issues
breakingStatic mode now opens HTML reports via file protocol instead of starting a server (since v1.2.3).
fix
If you rely on a server, set analyzerPort option.
affects: >=1.2.3
deprecatedRolldown plugin is experimental (unstableRolldownAdapter).
fix
Monitor releases for stable Rolldown support.
affects: >=1.3.0
gotchaVite enables minification by default; parsed size may appear larger than actual size.
fix
Use 'gzip' or 'brotli' as defaultSizes for more realistic sizes.
affects: >=1.0.0
gotchaPlugin only works during build phase, not dev server.
fix
Ensure you run npx vite build to generate analysis.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'vite-bundle-analyzer'
Installed as devDependency but not installed globally or in node_modules.
fix
Run 'npm install vite-bundle-analyzer --save-dev' in your project.
SyntaxError: Cannot use import statement outside a module
Using CommonJS require or running Node in non-ESM mode.
fix
Use import syntax or set type:'module' in package.json.
Error: Plugin is only applicable during the build phase
Used analyzer plugin in dev server or without build.
fix
Remove plugin from dev server config or run 'npx vite build'.
Upgrade
Version history
1.3.7latest on npm
Audit
Dependencies
viteoptionalPeer dependency for Vite plugin usage
rollupoptionalPeer dependency for Rollup plugin usage
Agent activity
8 hits · last 30 days
node
8
Resources
vite-bundle-analyzer — npm install vite-bundle-analyzer · libregistry