{"id":22280,"library":"rollup-plugin-visualizer","title":"rollup-plugin-visualizer","description":"rollup-plugin-visualizer v7.0.1 is a Rollup plugin that generates interactive visualizations (treemap, sunburst, network, raw-data) to analyze bundle composition and module size distribution. Requires Node >=22 and supports Rollup 2-4 and Rolldown 1.x. Unlike bundle-size analysis tools, it offers multiple visualization types and works at build time. Actively maintained with frequent releases.","status":"active","version":"7.0.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/btd/rollup-plugin-visualizer","tags":["javascript","rollup-plugin","visualizer","network","treemap","sunburst","diagram","typescript"],"install":[{"cmd":"npm install rollup-plugin-visualizer","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-visualizer","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-visualizer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to function as a Rollup plugin","package":"rollup","optional":false}],"imports":[{"note":"ESM-only since v6; CommonJS require will fail. TypeScript types included.","wrong":"const visualizer = require('rollup-plugin-visualizer')","symbol":"visualizer","correct":"import { visualizer } from 'rollup-plugin-visualizer'"},{"note":"Type export; use import type to avoid runtime inclusion.","wrong":"import { PluginVisualizerOptions } from 'rollup-plugin-visualizer'","symbol":"PluginVisualizerOptions","correct":"import type { PluginVisualizerOptions } from 'rollup-plugin-visualizer'"},{"note":"Default import works, but named import is preferred and more explicit.","wrong":"const visualizer = require('rollup-plugin-visualizer')","symbol":"default (deprecated)","correct":"import visualizer from 'rollup-plugin-visualizer'"}],"quickstart":{"code":"// rollup.config.js\nimport { visualizer } from 'rollup-plugin-visualizer';\n\nexport default {\n  input: 'src/index.js',\n  output: { dir: 'dist', format: 'esm' },\n  plugins: [\n    visualizer({\n      filename: 'stats.html',\n      title: 'Bundle Analysis',\n      open: true,\n      template: 'treemap',\n      gzipSize: true,\n      brotliSize: true,\n      sourcemap: false\n    })\n  ]\n};","lang":"typescript","description":"Rollup config with visualizer plugin generating treemap HTML report with gzip/brotli sizes."},"warnings":[{"fix":"Use import syntax and ensure project is configured for ESM (e.g., 'type': 'module' in package.json)","message":"ESM-only: This package requires Node >=22 and does not support CommonJS require()","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Update rollup to version 2, 3, or 4, or use an older version of the plugin","message":"Peer dependency rollup updated to require Rollup 2.x, 3.x, or 4.x only","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Explicitly set { open: false } if you do not want the browser to open automatically","message":"Plugin option 'open' default changed from false to true in v5","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use the 'sourcemap' option instead or configure Rollup's treeshaking directly","message":"The option 'treeshake' is deprecated and will be removed in a future version","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Place visualizer last in the plugins array to capture final bundle sizes","message":"Plugin must be applied after other plugins that modify the bundle (e.g., terser), otherwise sizes may be inaccurate","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Switch to import syntax or use dynamic import: const visualizer = (await import('rollup-plugin-visualizer')).visualizer;","cause":"Using CommonJS require() to import an ESM-only package","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Use named import: import { visualizer } from 'rollup-plugin-visualizer'","cause":"Default import used but package exports named export; or wrong import path","error":"TypeError: visualizer is not a function"},{"fix":"Install rollup: npm install rollup","cause":"Missing peer dependency","error":"Error: Package 'rollup' must be installed to use this plugin"},{"fix":"Use one of the supported templates: treemap, sunburst, network, raw-data","cause":"Misspelled or unsupported template name","error":"Error: Template 'circlepacking' is not available. Available templates: treemap, sunburst, network, raw-data"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}