From f332052a9248642f124db9cf454b61a59b9d5d92 Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Wed, 23 Oct 2024 12:28:12 +0200 Subject: [PATCH] auto enable in experimental build --- .../src/build/webpack/plugins/define-env-plugin.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/next/src/build/webpack/plugins/define-env-plugin.ts b/packages/next/src/build/webpack/plugins/define-env-plugin.ts index 20ad88f8f6f14..9ece98cd3701c 100644 --- a/packages/next/src/build/webpack/plugins/define-env-plugin.ts +++ b/packages/next/src/build/webpack/plugins/define-env-plugin.ts @@ -143,6 +143,10 @@ export function getDefineEnv({ const nextPublicEnv = getNextPublicEnvironmentVariables() const nextConfigEnv = getNextConfigEnv(config) + const isPPREnabled = checkIsAppPPREnabled(config.experimental.ppr) + const isDynamicIOEnabled = !!config.experimental.dynamicIO + const isOwnerStackEnabled = Boolean(config.experimental.reactOwnerStack) + const defineEnv: DefineEnv = { // internal field to identify the plugin config __NEXT_DEFINE_ENV: true, @@ -183,11 +187,10 @@ export function getDefineEnv({ 'process.env.__NEXT_APP_ISR_INDICATOR': Boolean( config.devIndicators.appIsrStatus ), - 'process.env.__NEXT_PPR': checkIsAppPPREnabled(config.experimental.ppr), - 'process.env.__NEXT_DYNAMIC_IO': !!config.experimental.dynamicIO, - 'process.env.__NEXT_REACT_OWNER_STACK': Boolean( - config.experimental.reactOwnerStack - ), + 'process.env.__NEXT_PPR': isPPREnabled, + 'process.env.__NEXT_DYNAMIC_IO': isDynamicIOEnabled, + 'process.env.__NEXT_REACT_OWNER_STACK': + isPPREnabled || isDynamicIOEnabled || isOwnerStackEnabled, 'process.env.__NEXT_AFTER': config.experimental.after ?? false, 'process.env.NEXT_DEPLOYMENT_ID': config.deploymentId || false, 'process.env.__NEXT_FETCH_CACHE_KEY_PREFIX': fetchCacheKeyPrefix ?? '',