Gathering detailed insights and metrics for rollup-plugin-webpack-stats
Gathering detailed insights and metrics for rollup-plugin-webpack-stats
Gathering detailed insights and metrics for rollup-plugin-webpack-stats
Gathering detailed insights and metrics for rollup-plugin-webpack-stats
Generate vite/rollup/rolldown stats JSON file with a bundle-stats webpack supported structure.
npm install rollup-plugin-webpack-stats
Typescript
Module System
Min. Node Version
Node Version
NPM Version
41
Supply Chain
72.9
Quality
94.9
Maintenance
100
Vulnerability
0
License
TypeScript (87.79%)
JavaScript (10.28%)
Shell (1.93%)
Total Downloads
3,002,254
Last Day
2,080
Last Week
51,861
Last Month
227,136
Last Year
1,894,413
MIT License
6 Stars
248 Commits
2 Forks
1 Watchers
5 Branches
4 Contributors
Updated on Jun 29, 2025
Minified
Minified + Gzipped
Latest Version
2.1.0
Package Id
rollup-plugin-webpack-stats@2.1.0
Unpacked Size
46.96 kB
Size
11.78 kB
File Count
20
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jun 29, 2025
Cumulative downloads
Total Downloads
1
Generate rollup stats JSON file with a bundle-stats webpack supported structure.
1npm install --dev rollup-plugin-webpack-stats
or
1yarn add --dev rollup-plugin-webpack-stats
or
1pnpm add -D rollup-plugin-webpack-stats
1// rollup.config.js 2import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; 3 4export default { 5 plugins: [ 6 // add it as the last plugin 7 webpackStatsPlugin(), 8 ], 9};
1// vite.config.js 2import { defineConfig } from 'vite'; 3import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; 4 5export default defineConfig((env) => ({ 6 plugins: [ 7 // Output webpack-stats.json file 8 webpackStatsPlugin(), 9 ], 10}));
fileName
- the JSON filepath relative to the build folder or absolute(default: webpack-stats.json
)transform
- access and mutate the resulting stats after the conversion: (stats: WebpackStatsFilterd, sources: TransformSources, bundle: OutputBundle) => WebpackStatsFilterd
moduleOriginalSize
- extract module original size or rendered size (default: false
)write
- format and write the stats to disk(default: fs.write(filename, JSON.stringify(stats, null, 2))
)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)>
1// rollup.config.js 2import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; 3 4module.exports = { 5 plugins: [ 6 // add it as the last plugin 7 webpackStatsPlugin({ 8 filename: 'artifacts/stats.json', 9 }), 10 ], 11};
.map
files1// rollup.config.js 2import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; 3 4export default { 5 plugins: [ 6 // add it as the last plugin 7 webpackStatsPlugin({ 8 excludeAssets: /\.map$/, 9 }), 10 ], 11};
1// for the the modern and legacy outputs 2import { defineConfig } from 'vite'; 3import legacy from '@vitejs/plugin-legacy'; 4import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; 5 6export default defineConfig((env) => ({ 7 build: { 8 rollupOptions: { 9 output: { 10 plugins: [ 11 // Output webpack-stats-modern.json file for the modern build 12 // Output webpack-stats-legacy.json file for the legacy build 13 // Stats are an output plugin, as plugin-legacy works by injecting 14 // an additional output, that duplicates the plugins configured here 15 webpackStatsPlugin((options) => { 16 const isLegacy = options.format === 'system'; 17 return { 18 fileName: `webpack-stats${isLegacy ? '-legacy' : '-modern'}.json`, 19 }; 20 }), 21 ], 22 }, 23 }, 24 }, 25 plugins: [ 26 legacy({ 27 /* Your legacy config here */ 28 }), 29 ], 30}));
1import { defineConfig } from 'vite'; 2import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; 3 4export default defineConfig((env) => ({ 5 build: { 6 rollupOptions: { 7 output: { 8 plugins: [ 9 webpackStatsPlugin({ 10 transform: (stats) => { 11 // Find the target chunk entry 12 const mainChunkIndex = stats.chunks?.findIndex((chunk) => chunk.names?.includes("main")); 13 14 // When the tartget chunk is found, set the initial flag to true 15 if (typeof mainChunkIndex !== 'undefined' && stats?.chunks?.[mainChunkIndex]) { 16 stats.chunks[mainChunkIndex] = { 17 ...stats.chunks[mainChunkIndex], 18 initial: true, 19 }; 20 } 21 22 // return the modified stats object 23 return stats; 24 }, 25 }), 26 ], 27 }, 28 }, 29 }, 30}));
No vulnerabilities found.
No security vulnerabilities found.
Last Day
1%
2,080
Compared to previous day
Last Week
-13.2%
51,861
Compared to previous week
Last Month
22.1%
227,136
Compared to previous month
Last Year
74.1%
1,894,413
Compared to previous year