Describe the bug
In standard Next.js, using Route Segment Configs like export const revalidate = 10 enforces 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 with revalidate fall back to fully dynamic execution on every request because Nitro's .output/nitro.json is missing the corresponding routeRules.
Expected behavior
When vinext encounters export const revalidate = X in a page.tsx or layout.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.tsx should generate the following in Nitro:
"routeRules": {
"/cache-tests/time-based": {
"swr": 10
}
}
Reproduction
- Create a page with
export const revalidate = 10; and a Date.now() output.
- Build with
vinext build.
- Start the
.output/server/index.mjs Nitro server.
- Load the page multiple times.
- Observe: The timestamp changes on every single reload, bypassing the 10-second cache configuration entirely.
Workaround
Currently, developers must manually wrap logic inside unstable_cache(..., { revalidate: 10 }) down at the component level to correctly trigger the underlying CacheHandler in vinext, completely bypassing the top-level Route Segment Config paradigm.
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.