
Webpack Bundle Analyzer
Webpack plugin and CLI that shows your bundle's contents as an interactive zoomable treemap.
- Stars
- 12.7k
- Forks
- 518
- Licence
- MIT
- Language
- JavaScript
- Last update
- 10 days ago
- Type
- Dev tool
What it is
When a web app is built with webpack, the output files (bundles) can get large and it is hard to see why. This tool reads the build output and draws an interactive treemap, where each box's size reflects how much space a module takes up, so you can zoom in and spot what is taking the most room. It can also report gzip, Brotli, or Zstandard sizes.
- Open a treemap report in the browser after a production build to see the largest modules
- Generate a static HTML report file to share with a teammate
- Export a JSON report for further analysis in other tools
- Find modules that were included by mistake
Great for
- Frontend developers trying to shrink a slow-loading webpack bundle
- Teams checking whether an unexpected library ended up in their bundle
- Anyone who wants to compare module sizes in a visual, clickable report
Not ideal for
- Projects that do not use webpack, since the tool is built around webpack output
- People who only need a quick number rather than a visual breakdown
- Non-developers, because it requires editing a webpack config or running a build command
How to get it
- 1
Install with a package manager
You'll need: Node.js · webpack
Install with NPM
npm install --save-dev webpack-bundle-analyzerInstall with Yarn
yarn add -D webpack-bundle-analyzer - 2
Run it
- Install the package as a dev dependency using npm or Yarn
- Add new BundleAnalyzerPlugin() to the plugins array in your webpack config
- Run your webpack build
- The report opens in your browser by default (server mode on 127.0.0.1:8888)
- 3
Get the most out of it
- Use analyzerMode set to static to generate a report.html file you can keep or share
- Set analyzerMode to json to produce a JSON report for scripting
- Set defaultSizes to gzip, brotli, or parsed to choose which size is shown first
- Set generateStatsFile to true to also write a webpack stats JSON file
Downloads
Strengths
- Shows interactive, zoomable treemap of bundle contents
- Parses minified bundles to estimate real module sizes
- Supports gzip, Brotli, and Zstandard size measurements
Trade-offs
- Requires webpack, so it does not help with other bundlers based on the README
- Needs to be added to a build configuration, which takes some setup knowledge
- README was truncated, so some options and details could not be fully verified
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| webpack-bundle-analyzer (this) | 12.7k | Dev tool | beginner | 10 days ago | Frontend developers trying to shrink a slow-loading webpack bundle |
| storybook | 91.4k | Dev tool | intermediate | 4 days ago | Frontend teams building a shared component library or design system |
| webpack | 66k | Dev tool | intermediate | 4 days ago | Frontend developers building single-page or multi-page web apps |
| webpack-dashboard | 14k | Dev tool | beginner | 2.2 years ago | Frontend developers who run webpack-dev-server or webpack in watch mode daily |
| electron-react-boilerplate | 24.3k | Dev tool | intermediate | 7 days ago | Developers who know React and want to build a cross-platform desktop app |
| tui.editor | 18k | Library | intermediate | 2.3 years ago | Web developers who want an embeddable Markdown editor in their own site or app |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.