Add retention controls for the Turbopack dev filesystem cache #94190
eliotgevers
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What problem should this solve?
Next 16 enables the Turbopack development filesystem cache by default, which is valuable for local dev performance. The cache is written under
.next/dev/cache/turbopack, but there does not appear to be a documented size or age limit for it.In a local monorepo using Next 16.2.6, I found:
The practical fix was to stop the dev server and delete
.next/dev.This is easy to confuse with Turborepo cache behavior. Turborepo already supports retention controls such as
cacheMaxSizeandcacheMaxAge, but those settings do not apply to Next/Turbopack's own dev filesystem cache.There is a related Help discussion about Turbopack dev performance and cache behavior in larger apps: #85744. This request is specifically for cache retention/management controls.
Suggested solution
Add built-in retention controls for the Turbopack dev filesystem cache, for example:
Other possible solutions:
.next/dev/cache/turbopacknext dev --prune-cachecommand.next/dev/cache/turbopackexceeds a large thresholdWhy this matters
Disabling the filesystem cache entirely is not ideal because it trades away useful dev performance. But without a retention policy, the cache can silently consume a large amount of disk space during normal development.
It would be great if Next had the same kind of predictable cache management pattern that Turborepo already provides.
Beta Was this translation helpful? Give feedback.
All reactions