Skip to content

Commit b4a5cdb

Browse files
committed
Reapply "[Breaking] Remove deprecated publicRuntimeConfig and serverRuntimeConfig (#83944)" (#84167)
This reverts commit aee02f8.
1 parent c294549 commit b4a5cdb

File tree

48 files changed

+12
-508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+12
-508
lines changed

crates/next-build-test/nextConfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
"productionBrowserSourceMaps": false,
5151
"optimizeFonts": true,
5252
"excludeDefaultMomentLocales": true,
53-
"serverRuntimeConfig": {},
54-
"publicRuntimeConfig": {},
5553
"reactProductionProfiling": false,
5654
"reactStrictMode": true,
5755
"httpAgentOptions": {

docs/01-app/02-guides/environment-variables.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ This allows you to use a singular Docker image that can be promoted through mult
228228
**Good to know:**
229229

230230
- You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).
231-
- We do not recommend using the [`runtimeConfig`](/docs/pages/api-reference/config/next-config-js/runtime-configuration) option, as this does not work with the standalone output mode. Instead, we recommend [incrementally adopting](/docs/app/guides/migrating/app-router-migration) the App Router if you need this feature.
232231

233232
## Test Environment Variables
234233

docs/01-app/02-guides/self-hosting.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ This allows you to use a singular Docker image that can be promoted through mult
7979
> **Good to know:**
8080
>
8181
> - You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).
82-
> - We do not recommend using the [runtimeConfig](/docs/pages/api-reference/config/next-config-js/runtime-configuration) option, as this does not work with the standalone output mode. Instead, we recommend [incrementally adopting](/docs/app/guides/migrating/app-router-migration) the App Router.
8382
8483
## Caching and ISR
8584

docs/01-app/03-api-reference/05-config/01-next-config-js/output.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ node .next/standalone/server.js
5959

6060
> **Good to know**:
6161
>
62-
> - `next.config.js` is read during `next build` and serialized into the `server.js` output file. If the legacy [`serverRuntimeConfig` or `publicRuntimeConfig` options](/docs/pages/api-reference/config/next-config-js/runtime-configuration) are being used, the values will be specific to values at build time.
62+
> - `next.config.js` is read during `next build` and serialized into the `server.js` output file.
6363
> - If your project needs to listen to a specific port or hostname, you can define `PORT` or `HOSTNAME` environment variables before running `server.js`. For example, run `PORT=8080 HOSTNAME=0.0.0.0 node server.js` to start the server on `http://0.0.0.0:8080`.
6464
6565
</PagesOnly>

docs/02-pages/04-api-reference/04-config/01-next-config-js/runtime-configuration.mdx

Lines changed: 0 additions & 60 deletions
This file was deleted.

packages/next/config.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/next/config.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/next/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
/// <reference path="./dist/styled-jsx/types/index.d.ts" />
44
/// <reference path="./app.d.ts" />
55
/// <reference path="./cache.d.ts" />
6-
/// <reference path="./config.d.ts" />
76
/// <reference path="./document.d.ts" />
87
/// <reference path="./dynamic.d.ts" />
98
/// <reference path="./error.d.ts" />

packages/next/src/build/index.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,9 +1924,7 @@ export default async function build(
19241924
}
19251925
}
19261926

1927-
const { configFileName, publicRuntimeConfig, serverRuntimeConfig } =
1928-
config
1929-
const runtimeEnvConfig = { publicRuntimeConfig, serverRuntimeConfig }
1927+
const { configFileName } = config
19301928
const sriEnabled = Boolean(config.experimental.sri?.algorithm)
19311929

19321930
const nonStaticErrorPageSpan = staticCheckSpan.traceChild(
@@ -1939,7 +1937,6 @@ export default async function build(
19391937
(await worker.hasCustomGetInitialProps({
19401938
page: '/_error',
19411939
distDir,
1942-
runtimeEnvConfig,
19431940
checkingApp: false,
19441941
sriEnabled,
19451942
}))
@@ -1953,7 +1950,6 @@ export default async function build(
19531950
page: '/_error',
19541951
distDir,
19551952
configFileName,
1956-
runtimeEnvConfig,
19571953
cacheComponents: isAppCacheComponentsEnabled,
19581954
authInterrupts: isAuthInterruptsEnabled,
19591955
httpAgentOptions: config.httpAgentOptions,
@@ -1973,7 +1969,6 @@ export default async function build(
19731969
? worker.hasCustomGetInitialProps({
19741970
page: appPageToCheck,
19751971
distDir,
1976-
runtimeEnvConfig,
19771972
checkingApp: true,
19781973
sriEnabled,
19791974
})
@@ -1983,7 +1978,6 @@ export default async function build(
19831978
? worker.getDefinedNamedExports({
19841979
page: appPageToCheck,
19851980
distDir,
1986-
runtimeEnvConfig,
19871981
sriEnabled,
19881982
})
19891983
: Promise.resolve([])
@@ -2167,7 +2161,6 @@ export default async function build(
21672161
originalAppPath,
21682162
distDir,
21692163
configFileName,
2170-
runtimeEnvConfig,
21712164
httpAgentOptions: config.httpAgentOptions,
21722165
locales: config.i18n?.locales,
21732166
defaultLocale: config.i18n?.defaultLocale,

packages/next/src/build/templates/edge-ssr.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ async function requestHandler(
153153
distDir: '',
154154
crossOrigin: nextConfig.crossOrigin ? nextConfig.crossOrigin : undefined,
155155
largePageDataBytes: nextConfig.experimental.largePageDataBytes,
156-
// Only the `publicRuntimeConfig` key is exposed to the client side
157-
// It'll be rendered as part of __NEXT_DATA__ on the client side
158-
runtimeConfig:
159-
Object.keys(nextConfig.publicRuntimeConfig).length > 0
160-
? nextConfig.publicRuntimeConfig
161-
: undefined,
162156

163157
isExperimentalCompile: nextConfig.experimental.isExperimentalCompile,
164158
// `htmlLimitedBots` is passed to server as serialized config in string format

0 commit comments

Comments
 (0)