feat(rolldown): sessions accumulate on disk with no cleanup — need max session limit
Clear and concise description of the problem
When devtools is enabled in Vite (Rolldown), a new session directory is written to node_modules/.rolldown/sid_*/ on every dev server start. Each session contains logs.json (~500MB+ for medium-sized projects) and meta.json.
There is no cleanup mechanism. Sessions accumulate indefinitely.
Real-world numbers from a mid-sized React project:
node_modules/.rolldown/ → 17 GB
└── sid_* × 113 sessions → ~568 MB each
After weeks of normal development (running vite dev daily), the .rolldown directory silently consumed 17 GB of disk space — all of it stale data from previous sessions.
Root cause
RolldownLogsManager.list() reads all sessions but never deletes any. There is no retention policy, no expiry, and no option to configure one.
Suggested solution
Add a maxSessions option to DevToolsRolldownUI() with a sensible default (e.g. 10).
On devtools startup, call a new RolldownLogsManager.cleanup(maxSessions) method that:
- Reads all sessions and sorts by
timestamp(oldest first) - Deletes sessions beyond the
maxSessionslimit usingfs.rm(..., { recursive: true }) - Silently no-ops if the
.rolldowndirectory does not exist yet
Why maxSessions and not "delete all but the latest"?
PR #371 (merged 2026-06-04) introduced a Session Compare panel — users can compare two build sessions side-by-side. Keeping only 1 session would break this workflow. A configurable limit (default 10) preserves the compare experience while bounding disk growth.
Setting maxSessions: 0 opts out of automatic cleanup entirely.
Validations
- [x] Follow our Code of Conduct
- [x] Read the Contributing Guide.
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.