Bundle Size Analyzer
A JavaScript bundle analysis panel: every chunk in a build gets a row with a proportional size bar, its raw KB, and a smaller secondary gzip-size bar underneath for comparison. Rows are color-coded by chunk type (app code, vendor, asset) with a small legend up top. Built for build-tool docs, CI reports, and performance-focused landing sections.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/bundle-size-analyzer.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/devtools/devtools21.tsx instead.
Usage
The file also exports devtools21Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Devtools21, devtools21Demo } from "@/components/blocks/devtools/devtools21"; export default function Page() { return <Devtools21 {...devtools21Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Bundle Size Analyzer" | Section heading. |
| description | string | undefined | Section intro text below the heading. |
| chunks | ChunkItem[] | [] | Rows in the bundle breakdown list, rendered in the order given. |
| className | string | none | Extra classes for the outer section element. |
Types
type ChunkType = "app" | "vendor" | "asset"; type ChunkItem = { name: string; type: ChunkType; sizeKb: number; gzipKb: number; };
Behavior notes
- Entirely static; no client-side interactivity, no real bundle parsing. sizeKb and gzipKb are caller-supplied numbers, not computed from an actual build.
- Every bar's width is calculated relative to the single largest chunk's sizeKb in the current chunks array, so bars stay comparable to each other but will rescale if the list of chunks changes.
- The secondary gzip bar underneath each row is scaled against that same largest-raw-size baseline (not against its own row's raw size), so it visually communicates how much smaller compression makes that chunk relative to the whole set.
- Chunk type colors are fixed (app code = sky, vendor = violet, asset = amber) and are not configurable per row beyond changing a chunk's type.
- In the demo data, gzip size equals raw size for asset-type chunks (a PNG and a WOFF2 font): that is realistic, not a bug, since already-compressed binary formats do not shrink further under gzip the way text-based JS chunks do.
More DevTools Blocks
View all →api-endpoints-sample-call
API Endpoints With Sample Call
Reference list of API endpoints paired with a live sample request and response panel.
cicd-pipeline-status
CI/CD Pipeline Status
Recent CI/CD pipeline runs with per-stage status chips and overall run badges.
code-diff-viewer
Code Diff Viewer
Unified code diff panel with a file header change summary and colored addition/deletion lines.
keyboard-shortcuts-reference
Keyboard Shortcuts Reference
Grouped keyboard shortcut reference with keycap-styled key combos.
performance-waterfall
Performance Waterfall
Network request waterfall chart with cascading timing bars colored by duration.
service-health-board
Service Health Board
Infrastructure status board with a live summary strip and per-service uptime, latency, and health.