Registry / devops / umi-webpack-bundle-analyzer

umi-webpack-bundle-analyzer

JSON →
library4.4.2jsnpmunverified

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.

npm install umi-webpack-bundle-analyzer
INSTALL
IMPORT
SIG · UMI-WEBPACK-BUNDLE
U
umi-webpack-bundle-analyzer
devopsjavascriptv4.4.2
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.

BundleAnalyzerPlugin
import { BundleAnalyzerPlugin } from 'umi-webpack-bundle-analyzer'
const BundleAnalyzerPlugin = require('umi-webpack-bundle-analyzer')
ESM and CJS both supported; named export.
BundleAnalyzerPlugin
const { BundleAnalyzerPlugin } = require('umi-webpack-bundle-analyzer')
const BundleAnalyzerPlugin = require('umi-webpack-bundle-analyzer').default
No default export; use named destructuring.
default
import { BundleAnalyzerPlugin } from 'umi-webpack-bundle-analyzer'
import BundleAnalyzerPlugin from 'umi-webpack-bundle-analyzer'
No default export in v4; must use named import.
analyzer
import { analyzer } from 'umi-webpack-bundle-analyzer'
const analyzer = require('umi-webpack-bundle-analyzer').analyzer
CLI utility also exported; both ESM and CJS work.

Shows how to use the plugin in a webpack config to generate a static HTML report and stats JSON file.

const { BundleAnalyzerPlugin } = require('umi-webpack-bundle-analyzer'); module.exports = { plugins: [ new BundleAnalyzerPlugin({ analyzerMode: 'static', reportFilename: 'report.html', openAnalyzer: false, generateStatsFile: true, statsFilename: 'stats.json', logLevel: 'info' }) ] };
webpack-bundle-analyzer --version
Debug
Known issues
breakingIn v4, the default export was removed; you must use the named export BundleAnalyzerPlugin.
fix
Change 'import BundleAnalyzerPlugin from ...' to 'import { BundleAnalyzerPlugin } from ...'.
affects: >=4.0.0
deprecatedThe 'startAnalyzer' option is deprecated in favor of 'openAnalyzer'.
fix
Use 'openAnalyzer' instead (default true).
affects: >=3.5.0
gotchaThe plugin does not work with webpack 5 in some versions; ensure you have the latest 4.x or upgrade to compatible version.
fix
Update to umi-webpack-bundle-analyzer@4.2.0 or later.
affects: <4.2.0
gotchaRequires Node.js >= 10.13.0. Older Node versions cause cryptic errors.
fix
Upgrade Node.js to at least 10.13.0.
affects: >=4.0.0
gotchaWhen using 'generateStatsFile', the stats are emitted to the output directory; ensure write permissions.
fix
Set 'output.path' in webpack config to a writable directory.
affects: >=3.0.0
Errors
Common errors & fixes
Error: options is required
The plugin constructor expects an options object. Passing nothing or undefined triggers this error in some versions.
fix
new BundleAnalyzerPlugin({}) or provide at least one option.
TypeError: BundleAnalyzerPlugin is not a constructor
Using default import instead of named import.
fix
Use const { BundleAnalyzerPlugin } = require('umi-webpack-bundle-analyzer') or import { BundleAnalyzerPlugin } from ...
Module not found: Error: Can't resolve 'umi-webpack-bundle-analyzer'
Package not installed or webpack resolve misconfiguration.
fix
Run 'npm install --save-dev umi-webpack-bundle-analyzer' or 'yarn add -D umi-webpack-bundle-analyzer'.
Error: Cannot find module 'webpack'
The plugin has a peer dependency on webpack; missing or version mismatch.
fix
Install webpack: 'npm install --save-dev webpack@4' (or 5 compatible).
Upgrade
Version history
4.4.2latest on npm
Audit
Dependencies
webpackoptionalPlugin integrates with webpack compilation; v4+ compatible.
Agent activity
6 hits · last 30 days
node
6
Resources
umi-webpack-bundle-analyzer — npm install umi-webpack-bundle-analyzer · libregistry