{"id":20529,"library":"rollup-plugin-webpack-stats","title":"rollup-plugin-webpack-stats","description":"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.","status":"active","version":"3.1.1","language":"javascript","source_language":"en","source_url":"https://github.com/relative-ci/rollup-plugin-webpack-stats","tags":["javascript","vite","rolldown","rollup","vite-plugin","rolldown-plugin","rollup-plugin","stats","bundle-stats","typescript"],"install":[{"cmd":"npm install rollup-plugin-webpack-stats","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-webpack-stats","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-webpack-stats","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only since v3.0.0; CJS require will fail.","wrong":"const webpackStatsPlugin = require('rollup-plugin-webpack-stats')","symbol":"default","correct":"import webpackStatsPlugin from 'rollup-plugin-webpack-stats'"},{"note":"Default export only; named import not supported.","wrong":"import { webpackStatsPlugin } from 'rollup-plugin-webpack-stats'","symbol":"webpackStatsPlugin","correct":"import webpackStatsPlugin from 'rollup-plugin-webpack-stats'"},{"note":"TypeScript type import for options object.","symbol":"WebpackStatsPluginOptions","correct":"import type { WebpackStatsPluginOptions } from 'rollup-plugin-webpack-stats'"}],"quickstart":{"code":"// rollup.config.js\nimport webpackStatsPlugin from 'rollup-plugin-webpack-stats';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    // Must be last plugin\n    webpackStatsPlugin()\n  ]\n};\n\n// vite.config.js\nimport { defineConfig } from 'vite';\nimport webpackStatsPlugin from 'rollup-plugin-webpack-stats';\n\nexport default defineConfig(() => ({\n  plugins: [\n    webpackStatsPlugin()\n  ]\n}));","lang":"javascript","description":"Shows basic setup for Rollup and Vite config files. Plugin must be the last in the plugins array to capture final bundle stats."},"warnings":[{"fix":"Use ESM import syntax: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'","message":"CommonJS require() not supported in v3.0.0+","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade to Node 18 or later","message":"Node <18 no longer supported in v3.0.0+","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Place webpackStatsPlugin() at the end of the plugins array","message":"Plugin must be the last plugin in plugins array","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"npm install rollup-plugin-webpack-stats@latest","message":"v2.x line is deprecated; upgrade to v3.x for TypeScript fixes and ESM support","severity":"deprecated","affected_versions":"<3.0.0"},{"fix":"Install rolldown separately: npm install rolldown@^1.0.0-beta.0","message":"Rolldown 1.0.0-beta.x is a peer dependency, not included automatically","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Change to import syntax: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'","cause":"Using require() to import the plugin, but it is ESM-only since v3","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Use default import: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'","cause":"Using named import instead of default import","error":"TypeError: webpackStatsPlugin is not a function"},{"fix":"Use default import: import webpackStatsPlugin from 'rollup-plugin-webpack-stats'","cause":"Named import attempted, but only default export exists","error":"Error: The requested module 'rollup-plugin-webpack-stats' does not provide an export named 'webpackStatsPlugin'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}