{"id":20715,"library":"webpack-bundle-size-analyzer","title":"Webpack Bundle Size Analyzer","description":"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.","status":"maintenance","version":"3.1.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/robertknight/webpack-bundle-size-analyzer","tags":["javascript","webpack"],"install":[{"cmd":"npm install webpack-bundle-size-analyzer","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-bundle-size-analyzer","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-bundle-size-analyzer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Requires webpack to generate JSON output; the tool parses webpack --json output","package":"webpack","optional":false}],"imports":[{"note":"ESM import works in bundler environments; CommonJS require also works but note the .WebpackBundleSizeAnalyzerPlugin property.","wrong":"const WebpackBundleSizeAnalyzerPlugin = require('webpack-bundle-size-analyzer').WebpackBundleSizeAnalyzerPlugin","symbol":"WebpackBundleSizeAnalyzerPlugin","correct":"import { WebpackBundleSizeAnalyzerPlugin } from 'webpack-bundle-size-analyzer'"},{"note":"There is no default export; the default import is undefined. Use named import instead.","wrong":"const webpackBundleSizeAnalyzer = require('webpack-bundle-size-analyzer')","symbol":"default import","correct":"import webpackBundleSizeAnalyzer from 'webpack-bundle-size-analyzer'"}],"quickstart":{"code":"import { WebpackBundleSizeAnalyzerPlugin } from 'webpack-bundle-size-analyzer';\nimport { Configuration } from 'webpack';\n\nconst config: Configuration = {\n  entry: './src/index.js',\n  output: {\n    path: '/dist',\n    filename: 'bundle.js'\n  },\n  plugins: [\n    new WebpackBundleSizeAnalyzerPlugin('./reports/size-report.txt')\n  ]\n};\n\nexport default config;","lang":"typescript","description":"Shows how to add the plugin to a webpack config (TypeScript) to write a size report file."},"warnings":[{"fix":"Use webpack-bundle-analyzer for post-minification size analysis.","message":"Sizes are reported before minification/uglification, so actual bundle sizes may be smaller.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use webpack-bundle-analyzer or source-map-explorer for webpack 4+.","message":"This tool only works with webpack 1–3; webpack 4+ changed the JSON output format.","severity":"breaking","affected_versions":">=4.0.0 <=3.1.0"},{"fix":"Consider migrating to webpack-bundle-analyzer.","message":"Package is in maintenance mode; no new features or webpack 4+ support planned.","severity":"deprecated","affected_versions":">=3.1.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install -g webpack-bundle-size-analyzer' or add to devDependencies.","cause":"Package not installed or global install missing.","error":"Error: Cannot find module 'webpack-bundle-size-analyzer'"},{"fix":"Ensure webpack --json is piped correctly and webpack config is valid.","cause":"Input JSON from webpack --json is malformed or empty.","error":"TypeError: Cannot read property 'modules' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}