vitejs / vitejs/devtools

feat(rolldown): sessions accumulate on disk with no cleanup — need max session limit

Open
#383 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
89
Avg merge
18h 46m
Merged PRs (30d)
24

Description

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:

  1. Reads all sessions and sorts by timestamp (oldest first)
  2. Deletes sessions beyond the maxSessions limit using fs.rm(..., { recursive: true })
  3. Silently no-ops if the .rolldown directory 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at DevToolsRolldownUI() and RolldownLogsManager.list(), then trace where devtools startup creates or reads .rolldown session directories. Add the maxSessions option and cleanup behavior described, using fs.rm for sessions beyond the timestamp-sorted limit; verify that maxSessions: 0 disables cleanup and missing directories are harmless.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.