Unverified Commit 423315a7 authored by Josh Story's avatar Josh Story Committed by GitHub

Remove the Cache Components deployment-test alias (#99446)

## Summary

Remove `NEXT_PRIVATE_EXPERIMENTAL_CACHE_COMPONENTS` to simplify how
deployment tests enable Cache Components. Capture
`__NEXT_CACHE_COMPONENTS` in the generated test config instead,
preserving deployment coverage and explicit config overrides without a
separate environment-variable alias.

## Verification

- `pnpm test-unit
test/unit/next-deploy-failure/next-deploy-failure.test.ts
--runTestsByPath --runInBand` — 19 tests passed.
- Loaded nine generated configs in fresh processes: enabled, disabled,
and unset test flags crossed with enabled, disabled, and unset
`cacheComponents` config. Flag propagation and explicit config overrides
were preserved.
- Live Vercel deployment tests passed against the preview package for
`654cad9519ce5af015d3cdbe23dd8ed1538662b8`, using Turbopack and
`__NEXT_CACHE_COMPONENTS=true`: `not-found-non-document-dynamic` (4
tests, inherited flag) and `prefetch-inlining-no-cache-components` (3
tests, explicit opt-out). The inherited-flag build enabled Cache
Components and produced partial prerenders.

<!-- NEXT_JS_LLM -->
parent b61c8e24
...@@ -533,6 +533,11 @@ export class NextInstance { ...@@ -533,6 +533,11 @@ export class NextInstance {
await fs.writeFile( await fs.writeFile(
fileName, fileName,
`${content}\n` + `${content}\n` +
// Capture the test flag in the config so it does not need a
// deployment-compatible environment variable alias.
(process.env.__NEXT_CACHE_COMPONENTS
? `process.env.__NEXT_CACHE_COMPONENTS = ${JSON.stringify(process.env.__NEXT_CACHE_COMPONENTS)}\n`
: '') +
` `
// alias __NEXT_TEST_MODE for next-deploy as "_" is not a valid // alias __NEXT_TEST_MODE for next-deploy as "_" is not a valid
// env variable during deploy // env variable during deploy
...@@ -541,9 +546,6 @@ export class NextInstance { ...@@ -541,9 +546,6 @@ export class NextInstance {
} }
// alias experimental feature flags for deployment compatibility // alias experimental feature flags for deployment compatibility
if (process.env.NEXT_PRIVATE_EXPERIMENTAL_CACHE_COMPONENTS) {
process.env.__NEXT_CACHE_COMPONENTS = process.env.NEXT_PRIVATE_EXPERIMENTAL_CACHE_COMPONENTS
}
if (process.env.NEXT_PRIVATE_EXPERIMENTAL_PARTIAL_PREFETCHING) { if (process.env.NEXT_PRIVATE_EXPERIMENTAL_PARTIAL_PREFETCHING) {
process.env.__NEXT_PARTIAL_PREFETCHING = process.env.NEXT_PRIVATE_EXPERIMENTAL_PARTIAL_PREFETCHING process.env.__NEXT_PARTIAL_PREFETCHING = process.env.NEXT_PRIVATE_EXPERIMENTAL_PARTIAL_PREFETCHING
} }
......
...@@ -495,11 +495,6 @@ export class NextDeployInstance extends NextInstance { ...@@ -495,11 +495,6 @@ export class NextDeployInstance extends NextInstance {
// Add experimental feature flags // Add experimental feature flags
if (process.env.__NEXT_CACHE_COMPONENTS) {
additionalEnv.push(
`NEXT_PRIVATE_EXPERIMENTAL_CACHE_COMPONENTS=${process.env.__NEXT_CACHE_COMPONENTS}`
)
}
if (process.env.__NEXT_PARTIAL_PREFETCHING) { if (process.env.__NEXT_PARTIAL_PREFETCHING) {
additionalEnv.push( additionalEnv.push(
`NEXT_PRIVATE_EXPERIMENTAL_PARTIAL_PREFETCHING=${process.env.__NEXT_PARTIAL_PREFETCHING}` `NEXT_PRIVATE_EXPERIMENTAL_PARTIAL_PREFETCHING=${process.env.__NEXT_PARTIAL_PREFETCHING}`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment