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.