From 860390167a7e1c7d559106aecc582d95339e28c0 Mon Sep 17 00:00:00 2001 From: Thai Pangsakulyanont Date: Wed, 30 Nov 2022 21:41:07 +0700 Subject: [PATCH] Clarify that publicRuntimeConfig and serverRuntimeConfig do not work with Output File Tracing (#43443) The **Output File Tracing** page mentioned that `publicRuntimeConfig` and `serverRuntimeConfig` are now legacy and does not work with Output File Tracing (they are _inlined at build-time_ instead of being set at runtime, the way it is supposed to work). image However, the Runtime Config page itself does not mention this at all. This led me into a wrong path for a while. ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm build && pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) Co-authored-by: Steven Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> --- docs/api-reference/next.config.js/runtime-configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-reference/next.config.js/runtime-configuration.md b/docs/api-reference/next.config.js/runtime-configuration.md index 94dd42551534..1f246250ee29 100644 --- a/docs/api-reference/next.config.js/runtime-configuration.md +++ b/docs/api-reference/next.config.js/runtime-configuration.md @@ -4,9 +4,9 @@ description: Add client and server runtime configuration to your Next.js app. # Runtime Configuration -> Generally you'll want to use [build-time environment variables](/docs/basic-features/environment-variables.md) to provide your configuration. The reason for this is that runtime configuration adds rendering / initialization overhead and is incompatible with [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md). +> Note: This feature is considered legacy and does not work with [Automatic Static Optimization](/docs/advanced-features/automatic-static-optimization.md), [Output File Tracing](/docs/advanced-features/output-file-tracing.md#automatically-copying-traced-files), or [React Server Components](/docs/advanced-features/react-18/server-components.md). Please use [environment variables](/docs/basic-features/environment-variables.md) instead in order to avoid initialization overhead. -To add runtime configuration to your app open `next.config.js` and add the `publicRuntimeConfig` and `serverRuntimeConfig` configs: +To add runtime configuration to your app, open `next.config.js` and add the `publicRuntimeConfig` and `serverRuntimeConfig` configs: ```js module.exports = {