{"id":21935,"library":"rollup-plugin-bundle-analyzer","title":"rollup-plugin-bundle-analyzer","description":"A Rollup plugin that visualizes the size of output files as an interactive zoomable treemap. Version 1.6.6 supports Rollup ^1.20.0 || ^2.0.0 || ^3.0.0, requires Node >=14.0.0, and ships TypeScript types. It provides multiple analyzer modes (server, static, json) and can display input, rendered (minified), and gzipped sizes. Unlike webpack-bundle-analyzer, this plugin is specifically for Rollup/Vite projects and parses minified bundles to show real module sizes. It supports excluding assets via patterns.","status":"active","version":"1.6.6","language":"javascript","source_language":"en","source_url":"https://github.com/Jerry2023/rollup-plugin-bundle-analyzer","tags":["javascript","vite","rollup","plugin","resolve","bundle","size","typescript"],"install":[{"cmd":"npm install rollup-plugin-bundle-analyzer","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-bundle-analyzer","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-bundle-analyzer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, required to work as a plugin","package":"rollup","optional":false}],"imports":[{"note":"Default export is the plugin function. CommonJS require may not work in ESM contexts; use dynamic import or import syntax.","wrong":"const bundleAnalyzer = require('rollup-plugin-bundle-analyzer')","symbol":"bundleAnalyzer","correct":"import bundleAnalyzer from 'rollup-plugin-bundle-analyzer'"},{"note":"The package uses default export, not named export.","wrong":"import { bundleAnalyzer } from 'rollup-plugin-bundle-analyzer'","symbol":"default","correct":"import bundleAnalyzer from 'rollup-plugin-bundle-analyzer'"},{"note":"TypeScript types are included; Options type is available for type-checking plugin options.","wrong":null,"symbol":"type Options","correct":"import type { Options } from 'rollup-plugin-bundle-analyzer'"}],"quickstart":{"code":"// rollup.config.js\nimport bundleAnalyzer from 'rollup-plugin-bundle-analyzer';\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    dir: 'dist',\n    format: 'esm'\n  },\n  plugins: [\n    bundleAnalyzer({\n      analyzerMode: 'static',\n      reportFilename: 'bundle-report.html',\n      generateStatsFile: true,\n      statsFilename: 'stats.json',\n      excludeAssets: '*.map'\n    })\n  ]\n};","lang":"typescript","description":"Configures rollup to generate a static HTML report and a stats JSON file, excluding source maps."},"warnings":[{"fix":"Use the official rollup-plugin-analyzer or wait for an update. Alternatively, pin rollup to version 3.x.","message":"Plugin does not work with Rollup 4.x. Only supports Rollup ^1.20.0 || ^2.0.0 || ^3.0.0.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Check your options object keys against the documentation.","message":"Options object properties are case-sensitive: 'analyzerMode', not 'mode'. 'host', not 'hostname'.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use an absolute path or ensure the relative path is correct.","message":"The 'reportFilename' in 'static' mode is relative to the output directory, not the project root.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove these options. They are no longer supported.","message":"Some options like 'startAutomatically' and 'openBrowser' are removed in recent versions.","severity":"deprecated","affected_versions":">=1.5.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev rollup-plugin-bundle-analyzer'","cause":"Package not installed or not in node_modules","error":"Error: Cannot find module 'rollup-plugin-bundle-analyzer'"},{"fix":"Use: import bundleAnalyzer from 'rollup-plugin-bundle-analyzer'","cause":"Imported incorrectly (named import instead of default import).","error":"TypeError: bundleAnalyzer is not a function"},{"fix":"Downgrade Rollup to version 3.x or use an alternative plugin.","cause":"Plugin only supports Rollup versions 1-3.","error":"Error: The current Rollup version (4.x.x) is not supported by rollup-plugin-bundle-analyzer"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}