{"id":20638,"library":"umi-webpack-bundle-analyzer","title":"Umi Webpack Bundle Analyzer","description":"Webpack plugin and CLI that generates an interactive zoomable treemap visualization of bundle contents, showing module sizes (stat, parsed, gzip). Current stable version is 4.4.2 (2023). A fork of webpack-contrib/webpack-bundle-analyzer by the UmiJS team. Actively maintained with regular releases. Supports both ESM and CJS imports. Key differentiator: designed to work seamlessly with UmiJS framework but also compatible with any Webpack project. Provides server, static, JSON, and disabled modes for flexible integration.","status":"active","version":"4.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/umijs/umi-webpack-bundle-analyzer","tags":["javascript","webpack","bundle","analyzer","modules","size","interactive","chart","treemap"],"install":[{"cmd":"npm install umi-webpack-bundle-analyzer","lang":"bash","label":"npm"},{"cmd":"yarn add umi-webpack-bundle-analyzer","lang":"bash","label":"yarn"},{"cmd":"pnpm add umi-webpack-bundle-analyzer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Plugin integrates with webpack compilation; v4+ compatible.","package":"webpack","optional":true}],"imports":[{"note":"ESM and CJS both supported; named export.","wrong":"const BundleAnalyzerPlugin = require('umi-webpack-bundle-analyzer')","symbol":"BundleAnalyzerPlugin","correct":"import { BundleAnalyzerPlugin } from 'umi-webpack-bundle-analyzer'"},{"note":"No default export; use named destructuring.","wrong":"const BundleAnalyzerPlugin = require('umi-webpack-bundle-analyzer').default","symbol":"BundleAnalyzerPlugin","correct":"const { BundleAnalyzerPlugin } = require('umi-webpack-bundle-analyzer')"},{"note":"No default export in v4; must use named import.","wrong":"import BundleAnalyzerPlugin from 'umi-webpack-bundle-analyzer'","symbol":"default","correct":"import { BundleAnalyzerPlugin } from 'umi-webpack-bundle-analyzer'"},{"note":"CLI utility also exported; both ESM and CJS work.","wrong":"const analyzer = require('umi-webpack-bundle-analyzer').analyzer","symbol":"analyzer","correct":"import { analyzer } from 'umi-webpack-bundle-analyzer'"}],"quickstart":{"code":"const { BundleAnalyzerPlugin } = require('umi-webpack-bundle-analyzer');\n\nmodule.exports = {\n  plugins: [\n    new BundleAnalyzerPlugin({\n      analyzerMode: 'static',\n      reportFilename: 'report.html',\n      openAnalyzer: false,\n      generateStatsFile: true,\n      statsFilename: 'stats.json',\n      logLevel: 'info'\n    })\n  ]\n};","lang":"javascript","description":"Shows how to use the plugin in a webpack config to generate a static HTML report and stats JSON file."},"warnings":[{"fix":"Change 'import BundleAnalyzerPlugin from ...' to 'import { BundleAnalyzerPlugin } from ...'.","message":"In v4, the default export was removed; you must use the named export BundleAnalyzerPlugin.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use 'openAnalyzer' instead (default true).","message":"The 'startAnalyzer' option is deprecated in favor of 'openAnalyzer'.","severity":"deprecated","affected_versions":">=3.5.0"},{"fix":"Update to umi-webpack-bundle-analyzer@4.2.0 or later.","message":"The plugin does not work with webpack 5 in some versions; ensure you have the latest 4.x or upgrade to compatible version.","severity":"gotcha","affected_versions":"<4.2.0"},{"fix":"Upgrade Node.js to at least 10.13.0.","message":"Requires Node.js >= 10.13.0. Older Node versions cause cryptic errors.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Set 'output.path' in webpack config to a writable directory.","message":"When using 'generateStatsFile', the stats are emitted to the output directory; ensure write permissions.","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":"new BundleAnalyzerPlugin({}) or provide at least one option.","cause":"The plugin constructor expects an options object. Passing nothing or undefined triggers this error in some versions.","error":"Error: options is required"},{"fix":"Use const { BundleAnalyzerPlugin } = require('umi-webpack-bundle-analyzer') or import { BundleAnalyzerPlugin } from ...","cause":"Using default import instead of named import.","error":"TypeError: BundleAnalyzerPlugin is not a constructor"},{"fix":"Run 'npm install --save-dev umi-webpack-bundle-analyzer' or 'yarn add -D umi-webpack-bundle-analyzer'.","cause":"Package not installed or webpack resolve misconfiguration.","error":"Module not found: Error: Can't resolve 'umi-webpack-bundle-analyzer'"},{"fix":"Install webpack: 'npm install --save-dev webpack@4' (or 5 compatible).","cause":"The plugin has a peer dependency on webpack; missing or version mismatch.","error":"Error: Cannot find module 'webpack'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}