mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #648] Next.js Route Segment Config (revalidate) is not mapped to Nitro routeRules (SWR) #135
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#135
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AhmedElBanna80 on GitHub (Mar 22, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/648
Describe the bug
In standard Next.js, using Route Segment Configs like
export const revalidate = 10enforces a specific cache lifetime for a page or layout.When building an application with
vinext build, this config is currently ignored and not forwarded to the generated Nitro output. As a result, pages configured withrevalidatefall back to fully dynamic execution on every request because Nitro's.output/nitro.jsonis missing the correspondingrouteRules.Expected behavior
When
vinextencountersexport const revalidate = Xin apage.tsxorlayout.tsx, it should automatically extract this and map it to the corresponding Nitro SWR route rule in the final Nitro configuration, allowing the Nitro server/edge runtime to accurately cache the responses natively.For example,
export const revalidate = 10;in/cache-tests/time-based/page.tsxshould generate the following in Nitro:Reproduction
export const revalidate = 10;and aDate.now()output.vinext build..output/server/index.mjsNitro server.Workaround
Currently, developers must manually wrap logic inside
unstable_cache(..., { revalidate: 10 })down at the component level to correctly trigger the underlying CacheHandler invinext, completely bypassing the top-level Route Segment Config paradigm.