Registry / devops / webpack-bundle-size-analyzer

webpack-bundle-size-analyzer

JSON →
library3.1.0jsnpmunverified

A CLI tool and webpack plugin that analyzes webpack's JSON output to display a tree of packages included in the bundle, sorted by size contribution. Version 3.1.0 is the latest stable release with no recent updates. It helps identify which dependencies are bloating the bundle. Unlike webpack-bundle-analyzer, it provides a plain text tree view rather than an interactive visualizer, and works with webpack 1–3 only. It supports two usage modes: piping webpack --json output to the CLI or adding a plugin to write a report file. Note: sizes are reported before minification/uglification.

npm install webpack-bundle-size-analyzer
INSTALL
IMPORT
SIG · WEBPACK-BUNDLE-SIZ
W
webpack-bundle-size-analyzer
devopsjavascriptv3.1.0
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.

WebpackBundleSizeAnalyzerPlugin
import { WebpackBundleSizeAnalyzerPlugin } from 'webpack-bundle-size-analyzer'
const WebpackBundleSizeAnalyzerPlugin = require('webpack-bundle-size-analyzer').WebpackBundleSizeAnalyzerPlugin
ESM import works in bundler environments; CommonJS require also works but note the .WebpackBundleSizeAnalyzerPlugin property.
default import
import webpackBundleSizeAnalyzer from 'webpack-bundle-size-analyzer'
const webpackBundleSizeAnalyzer = require('webpack-bundle-size-analyzer')
There is no default export; the default import is undefined. Use named import instead.

Shows how to add the plugin to a webpack config (TypeScript) to write a size report file.

import { WebpackBundleSizeAnalyzerPlugin } from 'webpack-bundle-size-analyzer'; import { Configuration } from 'webpack'; const config: Configuration = { entry: './src/index.js', output: { path: '/dist', filename: 'bundle.js' }, plugins: [ new WebpackBundleSizeAnalyzerPlugin('./reports/size-report.txt') ] }; export default config;
webpack-bundle-size-analyzer --version
Debug
Known issues
gotchaSizes are reported before minification/uglification, so actual bundle sizes may be smaller.
fix
Use webpack-bundle-analyzer for post-minification size analysis.
affects: >=1.0.0
breakingThis tool only works with webpack 1–3; webpack 4+ changed the JSON output format.
fix
Use webpack-bundle-analyzer or source-map-explorer for webpack 4+.
affects: >=4.0.0 <=3.1.0
deprecatedPackage is in maintenance mode; no new features or webpack 4+ support planned.
fix
Consider migrating to webpack-bundle-analyzer.
affects: >=3.1.0
Errors
Common errors & fixes
Error: Cannot find module 'webpack-bundle-size-analyzer'
Package not installed or global install missing.
fix
Run 'npm install -g webpack-bundle-size-analyzer' or add to devDependencies.
TypeError: Cannot read property 'modules' of undefined
Input JSON from webpack --json is malformed or empty.
fix
Ensure webpack --json is piped correctly and webpack config is valid.
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
webpackrequiredRequires webpack to generate JSON output; the tool parses webpack --json output
Agent activity
11 hits · last 30 days
node
10
Resources
webpack-bundle-size-analyzer — npm install webpack-bundle-size-analyzer · libregistry