Skip to content

Commit

Permalink
Clarify that publicRuntimeConfig and serverRuntimeConfig do not work …
Browse files Browse the repository at this point in the history
…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: Steven <steven@ceriously.com>
Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 30, 2022
1 parent 55e35c5 commit 8603901
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/api-reference/next.config.js/runtime-configuration.md
Expand Up @@ -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 = {
Expand Down

0 comments on commit 8603901

Please sign in to comment.