Share a bundle analyzer report

Everybody agrees the bundle is too big and nobody looks at the treemap. The reason is mechanical: the report is a file at dist/report.html on the machine that ran the build, and the way it reaches other people is a screenshot — a cropped picture of a visualization whose entire value is that you can zoom into it.

The file is already self-contained. It just needs an address.

Publish it

npx webpack-bundle-analyzer -m static -r report.html stats.json

curl -fsS -X PATCH \
  "https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html report.html \
        --arg title "Bundle — web — $(git rev-parse --short HEAD)" \
        '{title: $title, html: $html}')"

For Vite or Rollup, rollup-plugin-visualizer writes stats.html with the same self-contained shape — swap the first line and keep the rest.

PATCH rather than POST is the important half. One report id per app means one URL that always shows the current bundle, with every previous build sitting in the revision history behind it. That is the difference between a size report and a size trend.

What the URL changes

  • The treemap stays a treemap. Zoom, hover, gzip toggle — scripts run inside the sandboxed iframe. See interactive HTML reports.
  • A dependency gets a thread. Highlight the box, pin "this is moment.js, replaced in PR 812". See commenting on HTML.
  • Regressions are visible as a diff. Two revisions, one comparison.
  • A weekly digest posts itself. A routine can rebuild and republish on a cron so size creep surfaces without anyone remembering.

Limits

  • HTML body: 5 MB. Analyzer output for a large monorepo app can approach it; publish per entry point if it does.
  • Scripts run, sandboxed: allow-scripts, no allow-same-origin.
  • 60 requests/minute per token. Use a scoped token with reports:write only.

Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision history.

Publish a bundle report →

Related