Unverified Commit 86039016 authored by Thai Pangsakulyanont's avatar Thai Pangsakulyanont Committed by GitHub

Clarify that publicRuntimeConfig and serverRuntimeConfig do not work with Output…

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).

<img width="710" alt="image"
src="https://user-images.githubusercontent.com/193136/204200235-e7570c64-b760-48a8-bd72-46ed27e82363.png">

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: 's avatarSteven <steven@ceriously.com>
Co-authored-by: 's avatarDelba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
parent 55e35c51
...@@ -4,9 +4,9 @@ description: Add client and server runtime configuration to your Next.js app. ...@@ -4,9 +4,9 @@ description: Add client and server runtime configuration to your Next.js app.
# Runtime Configuration # 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 ```js
module.exports = { module.exports = {
......
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