Skip to content

bundle-analyzer: record historical snapshots on each analyze run#93520

Draft
wbinnssmith wants to merge 1 commit intocanaryfrom
wbinnssmith/bundle-analyzer-snapshot-recording
Draft

bundle-analyzer: record historical snapshots on each analyze run#93520
wbinnssmith wants to merge 1 commit intocanaryfrom
wbinnssmith/bundle-analyzer-snapshot-recording

Conversation

@wbinnssmith
Copy link
Copy Markdown
Member

@wbinnssmith wbinnssmith commented May 6, 2026

After each next experimental-analyze run, snapshot the output data into a rolling history/ directory so later builds can use it as a comparison baseline.

Each snapshot gets a metadata.json with git branch/sha/dirty status, Next.js version, and route count. A history/history.json index (newest-first, capped at 20 entries) lets the UI list available baselines without re-reading every snapshot directory. Old snapshots beyond the cap are pruned automatically.

The client-side SnapshotMetadata type mirror lives in apps/bundle-analyzer/lib/snapshot.ts so the compare UI can reference it without a build-time dependency on the Next.js package.

Copy link
Copy Markdown
Member Author

wbinnssmith commented May 6, 2026

After each successful analyze run (both `next build --analyze` and
`next experimental-analyze`), persist a snapshot of the current build's
data directory into `history/<id>/` alongside a `history/history.json`
index. The analyzer UI can use this index to offer comparison baselines
in a future PR.

Each snapshot captures git branch/sha/dirty state, Next.js version, and
route count. The history is capped at 20 snapshots; older entries are
pruned automatically.

Also adds `apps/bundle-analyzer/lib/snapshot.ts` with the client-side
type mirror that will be consumed by the comparison UI.
@wbinnssmith wbinnssmith force-pushed the wbinnssmith/bundle-analyzer-snapshot-recording branch from 07951e1 to 3473946 Compare May 6, 2026 00:43
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Tests Passed

Commit: 3473946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant