JavaScript Bundle Analyzer
Find out what makes your JavaScript bundle big: a zoomable treemap, size by package, duplicated libraries, a size budget and a module search.
ブラウザ内で動作します。ファイルは端末の外に出ません。 確認方法を見る
…
使い方
- 1Produce a stats file
Run your bundler with stats, metafile or visualizer output, or locate the .js.map file.
- 2Open it
Press Open stats or source map and select the file, plus the .js file for exact source map sizes.
- 3Explore the treemap
Click boxes to drill into folders and packages and use the breadcrumb to go back.
- 4Check packages
Open Packages to see the heaviest dependencies and tips.
- 5Remove duplicates
Open Duplicates to see which packages are bundled twice and how much it costs.
- 6Track the budget
Set a budget in KB and export the module list as CSV.
このツールについて
Large JavaScript bundles slow down page loads, especially on phones, and the cause is usually a few modules: a charting library imported whole, two copies of lodash, a date library with all its locales. This analyzer reads the files your build tool can already produce, webpack's stats.json, esbuild's metafile, the raw data of rollup-plugin-visualizer used with Vite and Rollup, or any source map, and shows where the bytes go. A squarified treemap lets you click from the whole bundle into folders and packages. Tables rank packages by size with tips for known heavy ones, list packages bundled more than once with the bytes you could save, and show every module. A budget tells you at a glance whether the bundle grew too big.
Who this is for
Front-end developers chasing performance, teams setting bundle budgets in CI, and anyone who wonders why a small app ships a megabyte of JavaScript.
Getting the input
webpack: webpack --json > stats.json (concatenated modules are split into their parts). esbuild: --metafile=meta.json, which records the bytes each input contributes to each output file. Vite and Rollup: rollup-plugin-visualizer with the raw-data template. Any bundler: the .js.map file.
Source maps done properly
A source map maps positions in the generated file back to original files. With only the .map file, the analyzer can show original source sizes from sourcesContent, which is useful but not what users download. Select the .map together with its .js file and the analyzer decodes the Base64 VLQ mappings and counts the generated bytes of every segment, giving exact bytes per original file plus any unmapped code such as bundler runtime.
Treemap
Rectangles are laid out with the squarified algorithm so they stay close to squares and are easy to compare. Area is proportional to size, hovering shows the path, size and share, and clicking a folder or package opens it; the breadcrumb leads back. Packages from node_modules appear as one box each, marked with a parcel icon.
Packages and duplicates
The package table separates your own code from dependencies and adds advice for libraries known to be heavy, such as moment, full lodash and chart.js. Duplicates are packages found under more than one node_modules folder, usually because two dependencies require different version ranges; the wasted bytes are the size of all copies except the largest.
Worked example
The sample bundle has 689,700 bytes (673.5 KB) in 17 modules. chart.js is the largest package at 205,300 bytes, react-dom follows with 131,900, and lodash appears twice, once nested under some-widget, wasting 72,500 bytes. Your own code is 52,900 bytes, under 8 %. With a 250 KB budget, the bundle is over by about 423 KB.
Limits
Sizes are uncompressed bytes; gzip or Brotli transfer sizes are typically three to four times smaller and are shown only when the visualizer data includes them. The analyzer cannot see code loaded at runtime from other servers, and large stats files may take a few seconds to read. Tree-shaking decisions are your bundler's; this tool reports the result.
計算例
673.5 KB bundle: chart.js 205 KB, lodash bundled twice (72.5 KB wasted), own code under 8 %.
ポイント
- カテゴリ: 開発・データ
- ブラウザ内で動作し、登録もアップロードも不要です。
- 入力した情報は端末内にとどまります。
- 英語で利用できます。
- 内容の最終確認日:
- 公式情報源: Source Map Revision 3 (ECMA-426) mappings with Base64 VLQ, webpack stats and esbuild metafile formats; squarified treemaps (Bruls, Huizing and van Wijk, 2000)
よくある質問
Which file should I use?
Whatever your bundler gives most easily: stats.json for webpack, a metafile for esbuild, visualizer raw data for Vite or Rollup, otherwise the source map.
Why are source map sizes different from file sizes?
Without the generated .js file, the original source sizes are shown. Add the .js file to count the bytes that actually ship.
What counts as a duplicate?
The same package name installed in more than one node_modules folder and included in the bundle.
How do I fix duplicates?
Align dependency versions, run your package manager's dedupe, or force one version with overrides or resolutions.
Are gzip sizes shown?
Only when the input contains them, as rollup-plugin-visualizer data does. Otherwise sizes are uncompressed.
Is my stats file uploaded?
No. Files are read in the browser and nothing leaves your computer.
