A Vite/Rolldown/Rollup plugin that generates a bundle stats JSON file (stats.json) containing detailed information about assets, chunks, and modules. Current stable version is 2.1.1. The plugin is actively maintained, with regular releases (multiple per month). Key differentiators: works across Vite (v5–v8), Rolldown (v1), and Rollup (v3–v4); supports selective asset/module inclusion/exclusion; integrates with RelativeCI and bundle-stats ecosystem for further analysis. Requires Node >=18.
npm install rollup-plugin-statsVerified import paths — ran on the pinned version, not inferred.
Shows the minimal Vite config to generate bundle stats JSON. Plugin is added last, output goes to stats.json.
Use `import pluginStats from 'rollup-plugin-stats'` or `const pluginStats = require('rollup-plugin-stats')` (no .default).Place pluginStats() after all other plugins in the plugins array.
Use `const pluginStats = require('rollup-plugin-stats')` directly.Either back up existing stats.json or use a custom `write` option to handle overwriting.
Only enable `stats.source` if required for analysis; avoid in production CI artifacts.
Upgrade to v2.0.0+ or use dynamic import: `const pluginStats = (await import('rollup-plugin-stats')).default`.Use `const pluginStats = require('rollup-plugin-stats')` (no .default) for CommonJS.Move pluginStats() to the end of the plugins array.
Install with `npm install --save-dev rollup-plugin-stats` and ensure tsconfig includes `node_modules` or has `moduleResolution: 'node'` or 'bundler'.
No dependency data recorded yet.