Skip to content

Commit 61b9da1

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

File tree

48 files changed

+13
-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

+13
-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
@@ -1914,9 +1914,7 @@ export default async function build(
19141914
}
19151915
}
19161916

1917-
const { configFileName, publicRuntimeConfig, serverRuntimeConfig } =
1918-
config
1919-
const runtimeEnvConfig = { publicRuntimeConfig, serverRuntimeConfig }
1917+
const { configFileName } = config
19201918
const sriEnabled = Boolean(config.experimental.sri?.algorithm)
19211919

19221920
const nonStaticErrorPageSpan = staticCheckSpan.traceChild(
@@ -1929,7 +1927,6 @@ export default async function build(
19291927
(await worker.hasCustomGetInitialProps({
19301928
page: '/_error',
19311929
distDir,
1932-
runtimeEnvConfig,
19331930
checkingApp: false,
19341931
sriEnabled,
19351932
}))
@@ -1943,7 +1940,6 @@ export default async function build(
19431940
page: '/_error',
19441941
distDir,
19451942
configFileName,
1946-
runtimeEnvConfig,
19471943
cacheComponents: isAppCacheComponentsEnabled,
19481944
authInterrupts: isAuthInterruptsEnabled,
19491945
httpAgentOptions: config.httpAgentOptions,
@@ -1963,7 +1959,6 @@ export default async function build(
19631959
? worker.hasCustomGetInitialProps({
19641960
page: appPageToCheck,
19651961
distDir,
1966-
runtimeEnvConfig,
19671962
checkingApp: true,
19681963
sriEnabled,
19691964
})
@@ -1973,7 +1968,6 @@ export default async function build(
19731968
? worker.getDefinedNamedExports({
19741969
page: appPageToCheck,
19751970
distDir,
1976-
runtimeEnvConfig,
19771971
sriEnabled,
19781972
})
19791973
: Promise.resolve([])
@@ -2157,7 +2151,6 @@ export default async function build(
21572151
originalAppPath,
21582152
distDir,
21592153
configFileName,
2160-
runtimeEnvConfig,
21612154
httpAgentOptions: config.httpAgentOptions,
21622155
locales: config.i18n?.locales,
21632156
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)