Commit Graph

1 Commits

Author SHA1 Message Date
Nathan Nguyen d2ffc83670 fix(config): define cache components flag as boolean (#1903)
* fix(config): define cache components flag as boolean

Disabled cache components currently compile to a truthy "false" string. That diverges from Next.js and makes bundled user code that checks !!process.env.__NEXT_CACHE_COMPONENTS select the cache-components path even when next.config rewrites select the legacy destination.

Mirror Next.js by defining process.env.__NEXT_CACHE_COMPONENTS as a boolean expression, and keep the local slot shim tolerant of both boolean defines and string env values. Add a faithful revalidatePath-with-rewrites production regression that proves rewritten static and dynamic routes invalidate after revalidating the resolved destination path.

* test(prod-server): cover cacheComponents enabled revalidatePath with rewrites

* test(prod-server): skip dist/ copy in cacheComponents fs.cpSync filter

Addresses review feedback: fs.cpSync(APP_FIXTURE_DIR, fixtureRoot)
copies the earlier-built dist/ directory into the temp fixture before it
is immediately deleted. Adding a filter skips the unnecessary copy.
2026-06-11 12:53:35 +01:00