rollup-plugin-stats

Vite/Rolldown/Rollup plugin to generate bundle stats JSON file
Install
npm install --dev rollup-plugin-stats
or
yarn add --dev rollup-plugin-stats
Configure
Vite
import { defineConfig } from 'vite';
import pluginStats from 'rollup-plugin-stats';
export default defineConfig({
plugins: [
pluginStats(),
],
});
Rollup
import { defineConfig } from 'rollup';
import pluginStats from 'rollup-plugin-stats';
export default defineConfig({
plugins: [
pluginStats(),
],
});
const { defineConfig } = require('rollup');
const pluginStats = require('rollup-plugin-stats');
module.exports = defineConfig({
plugins: [
pluginStats(),
],
});
Rolldown
import { defineConfig } from 'rolldown';
import pluginStats from 'rollup-plugin-stats';
export default defineConfig({
plugins: [
pluginStats(),
],
});
Options
fileName - the JSON filepath relative to the build folder or absolute(default: stats.json)
write - format and write the stats to disk(default: fs.write(filename, JSON.stringify(stats, null, 2)))
stats
source - output asset/chunk/module source (default false)
map - output chunk map property (default: false)
excludeAssets - exclude matching assets: string | RegExp | ((filepath: string) => boolean) | Array<string | RegExp | ((filepath: string) => boolean)>
excludeModules - exclude matching modules: string | RegExp | ((filepath: string) => boolean) | Array<string | RegExp | ((filepath: string) => boolean)>
Development setup
Use the project node version
nvm use
Install dependencies
npm install
Prepare
npm run prepare
Related projects
Analyze bundle stats(bundle size, assets, modules, packages) and compare the results between different builds. Support for webpack, rspack, vite, rolldown and rollup.
Generate vite/rollup/rolldown stats JSON file with a bundle-stats webpack supported structure.
Automated bundle analysis, reviews and monitoring - Quickly identify and fix bundle regressions before shipping to production.
- :crystal_ball: In-depth bundle stats analysis for every build
- :chart_with_upwards_trend: Monitor bundle stats changes and identify opportunities for optimizations
- :bell: Quick feedback with rule based automated review flow, GitHub Pull Request comments, GitHub check reports, or Slack messages
- :wrench: Support for webpack, vite, rspack, rollup, rolldown
- :hammer: Support for all major CI services(CircleCI, GitHub Actions, Gitlab CI, Jenkins, Travis CI)
- :nut_and_bolt: Support for npm, yarn and pnpm; support for monorepos
- :two_hearts: Always free for Open Source
:rocket: Get started