Registry / devops / rollup-plugin-webpack-stats

rollup-plugin-webpack-stats

JSON →
library3.1.1jsnpmunverified

A Rollup/Vite/Rolldown plugin (v3.1.1, released April 2026) that generates a stats JSON file with a webpack-compatible structure, enabling use of webpack ecosystem tools like bundle-stats and analyze tools with non-webpack builds. It supports Rollup 3/4, Vite 5-8, and Rolldown 1.0 beta, ships TypeScript types, and offers options like custom filename, asset/module filtering, and transform callback. Unlike direct webpack stats generation, it converts Rollup's output format to the webpack stats schema, making it a bridge tool.

npm install rollup-plugin-webpack-stats
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-WEBP
R
rollup-plugin-webpack-stats
devopsjavascriptv3.1.1
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.

default
import webpackStatsPlugin from 'rollup-plugin-webpack-stats'
const webpackStatsPlugin = require('rollup-plugin-webpack-stats')
ESM-only since v3.0.0; CJS require will fail.
webpackStatsPlugin
import webpackStatsPlugin from 'rollup-plugin-webpack-stats'
import { webpackStatsPlugin } from 'rollup-plugin-webpack-stats'
Default export only; named import not supported.
WebpackStatsPluginOptions
import type { WebpackStatsPluginOptions } from 'rollup-plugin-webpack-stats'
TypeScript type import for options object.

Shows basic setup for Rollup and Vite config files. Plugin must be the last in the plugins array to capture final bundle stats.

// rollup.config.js import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm' }, plugins: [ // Must be last plugin webpackStatsPlugin() ] }; // vite.config.js import { defineConfig } from 'vite'; import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; export default defineConfig(() => ({ plugins: [ webpackStatsPlugin() ] }));
Debug
Known issues
breakingCommonJS require() not supported in v3.0.0+
fix
Use ESM import syntax: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'
affects: >=3.0.0
breakingNode <18 no longer supported in v3.0.0+
fix
Upgrade to Node 18 or later
affects: >=3.0.0
breakingPlugin must be the last plugin in plugins array
fix
Place webpackStatsPlugin() at the end of the plugins array
affects: >=1.0.0
deprecatedv2.x line is deprecated; upgrade to v3.x for TypeScript fixes and ESM support
fix
npm install rollup-plugin-webpack-stats@latest
affects: <3.0.0
gotchaRolldown 1.0.0-beta.x is a peer dependency, not included automatically
fix
Install rolldown separately: npm install rolldown@^1.0.0-beta.0
affects: >=3.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using require() to import the plugin, but it is ESM-only since v3
fix
Change to import syntax: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'
TypeError: webpackStatsPlugin is not a function
Using named import instead of default import
fix
Use default import: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'
Error: The requested module 'rollup-plugin-webpack-stats' does not provide an export named 'webpackStatsPlugin'
Named import attempted, but only default export exists
fix
Use default import: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'
Upgrade
Version history
3.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
rollup-plugin-webpack-stats — npm install rollup-plugin-webpack-stats · libregistry