Unverified Commit aee02f85 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Revert "[Breaking] Remove deprecated `publicRuntimeConfig` and…

Revert "[Breaking] Remove deprecated `publicRuntimeConfig` and `serverRuntimeConfig` (#83944)" (#84167)

This PR reverts #83944 as it was missing a deprecation warning in the
app, which is easy to miss for the users.
parent b1d412cc
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
"productionBrowserSourceMaps": false, "productionBrowserSourceMaps": false,
"optimizeFonts": true, "optimizeFonts": true,
"excludeDefaultMomentLocales": true, "excludeDefaultMomentLocales": true,
"serverRuntimeConfig": {},
"publicRuntimeConfig": {},
"reactProductionProfiling": false, "reactProductionProfiling": false,
"reactStrictMode": true, "reactStrictMode": true,
"httpAgentOptions": { "httpAgentOptions": {
......
...@@ -228,6 +228,7 @@ This allows you to use a singular Docker image that can be promoted through mult ...@@ -228,6 +228,7 @@ This allows you to use a singular Docker image that can be promoted through mult
**Good to know:** **Good to know:**
- You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation). - You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).
- 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.
## Test Environment Variables ## Test Environment Variables
......
...@@ -79,6 +79,7 @@ This allows you to use a singular Docker image that can be promoted through mult ...@@ -79,6 +79,7 @@ This allows you to use a singular Docker image that can be promoted through mult
> **Good to know:** > **Good to know:**
> >
> - You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation). > - You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).
> - 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.
## Caching and ISR ## Caching and ISR
......
...@@ -59,7 +59,7 @@ node .next/standalone/server.js ...@@ -59,7 +59,7 @@ node .next/standalone/server.js
> **Good to know**: > **Good to know**:
> >
> - `next.config.js` is read during `next build` and serialized into the `server.js` output file. > - `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.
> - 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`. > - 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`.
</PagesOnly> </PagesOnly>
......
---
title: Runtime Config
description: Add client and server runtime configuration to your Next.js app.
---
> **Warning:**
>
> - **This feature is deprecated.** We recommend using [environment variables](/docs/pages/guides/environment-variables) instead, which also can support reading runtime values.
> - You can run code on server startup using the [`register` function](/docs/app/guides/instrumentation).
> - This feature does not work with [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization), [Output File Tracing](/docs/pages/api-reference/config/next-config-js/output#automatically-copying-traced-files), or [React Server Components](/docs/app/getting-started/server-and-client-components).
To add runtime configuration to your app, open `next.config.js` and add the `publicRuntimeConfig` and `serverRuntimeConfig` configs:
```js filename="next.config.js"
module.exports = {
serverRuntimeConfig: {
// Will only be available on the server side
mySecret: 'secret',
secondSecret: process.env.SECOND_SECRET, // Pass through env variables
},
publicRuntimeConfig: {
// Will be available on both server and client
staticFolder: '/static',
},
}
```
Place any server-only runtime config under `serverRuntimeConfig`.
Anything accessible to both client and server-side code should be under `publicRuntimeConfig`.
> A page that relies on `publicRuntimeConfig` **must** use `getInitialProps` or `getServerSideProps` or your application must have a [Custom App](/docs/pages/building-your-application/routing/custom-app) with `getInitialProps` to opt-out of [Automatic Static Optimization](/docs/pages/building-your-application/rendering/automatic-static-optimization). Runtime configuration won't be available to any page (or component in a page) without being server-side rendered.
To get access to the runtime configs in your app use `next/config`, like so:
```jsx
import getConfig from 'next/config'
import Image from 'next/image'
// Only holds serverRuntimeConfig and publicRuntimeConfig
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
// Will only be available on the server-side
console.log(serverRuntimeConfig.mySecret)
// Will be available on both server-side and client-side
console.log(publicRuntimeConfig.staticFolder)
function MyImage() {
return (
<div>
<Image
src={`${publicRuntimeConfig.staticFolder}/logo.png`}
alt="logo"
layout="fill"
/>
</div>
)
}
export default MyImage
```
import getConfig from './dist/shared/lib/runtime-config.external'
export * from './dist/shared/lib/runtime-config.external'
export default getConfig
module.exports = require('./dist/shared/lib/runtime-config.external')
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
/// <reference path="./amp.d.ts" /> /// <reference path="./amp.d.ts" />
/// <reference path="./app.d.ts" /> /// <reference path="./app.d.ts" />
/// <reference path="./cache.d.ts" /> /// <reference path="./cache.d.ts" />
/// <reference path="./config.d.ts" />
/// <reference path="./document.d.ts" /> /// <reference path="./document.d.ts" />
/// <reference path="./dynamic.d.ts" /> /// <reference path="./dynamic.d.ts" />
/// <reference path="./error.d.ts" /> /// <reference path="./error.d.ts" />
......
...@@ -1909,7 +1909,9 @@ export default async function build( ...@@ -1909,7 +1909,9 @@ export default async function build(
} }
} }
const { configFileName } = config const { configFileName, publicRuntimeConfig, serverRuntimeConfig } =
config
const runtimeEnvConfig = { publicRuntimeConfig, serverRuntimeConfig }
const sriEnabled = Boolean(config.experimental.sri?.algorithm) const sriEnabled = Boolean(config.experimental.sri?.algorithm)
const nonStaticErrorPageSpan = staticCheckSpan.traceChild( const nonStaticErrorPageSpan = staticCheckSpan.traceChild(
...@@ -1922,6 +1924,7 @@ export default async function build( ...@@ -1922,6 +1924,7 @@ export default async function build(
(await worker.hasCustomGetInitialProps({ (await worker.hasCustomGetInitialProps({
page: '/_error', page: '/_error',
distDir, distDir,
runtimeEnvConfig,
checkingApp: false, checkingApp: false,
sriEnabled, sriEnabled,
})) }))
...@@ -1935,6 +1938,7 @@ export default async function build( ...@@ -1935,6 +1938,7 @@ export default async function build(
page: '/_error', page: '/_error',
distDir, distDir,
configFileName, configFileName,
runtimeEnvConfig,
cacheComponents: isAppCacheComponentsEnabled, cacheComponents: isAppCacheComponentsEnabled,
authInterrupts: isAuthInterruptsEnabled, authInterrupts: isAuthInterruptsEnabled,
httpAgentOptions: config.httpAgentOptions, httpAgentOptions: config.httpAgentOptions,
...@@ -1954,6 +1958,7 @@ export default async function build( ...@@ -1954,6 +1958,7 @@ export default async function build(
? worker.hasCustomGetInitialProps({ ? worker.hasCustomGetInitialProps({
page: appPageToCheck, page: appPageToCheck,
distDir, distDir,
runtimeEnvConfig,
checkingApp: true, checkingApp: true,
sriEnabled, sriEnabled,
}) })
...@@ -1963,6 +1968,7 @@ export default async function build( ...@@ -1963,6 +1968,7 @@ export default async function build(
? worker.getDefinedNamedExports({ ? worker.getDefinedNamedExports({
page: appPageToCheck, page: appPageToCheck,
distDir, distDir,
runtimeEnvConfig,
sriEnabled, sriEnabled,
}) })
: Promise.resolve([]) : Promise.resolve([])
...@@ -2149,6 +2155,7 @@ export default async function build( ...@@ -2149,6 +2155,7 @@ export default async function build(
originalAppPath, originalAppPath,
distDir, distDir,
configFileName, configFileName,
runtimeEnvConfig,
httpAgentOptions: config.httpAgentOptions, httpAgentOptions: config.httpAgentOptions,
locales: config.i18n?.locales, locales: config.i18n?.locales,
defaultLocale: config.i18n?.defaultLocale, defaultLocale: config.i18n?.defaultLocale,
......
...@@ -155,6 +155,12 @@ async function requestHandler( ...@@ -155,6 +155,12 @@ async function requestHandler(
distDir: '', distDir: '',
crossOrigin: nextConfig.crossOrigin ? nextConfig.crossOrigin : undefined, crossOrigin: nextConfig.crossOrigin ? nextConfig.crossOrigin : undefined,
largePageDataBytes: nextConfig.experimental.largePageDataBytes, largePageDataBytes: nextConfig.experimental.largePageDataBytes,
// Only the `publicRuntimeConfig` key is exposed to the client side
// It'll be rendered as part of __NEXT_DATA__ on the client side
runtimeConfig:
Object.keys(nextConfig.publicRuntimeConfig).length > 0
? nextConfig.publicRuntimeConfig
: undefined,
isExperimentalCompile: nextConfig.experimental.isExperimentalCompile, isExperimentalCompile: nextConfig.experimental.isExperimentalCompile,
// `htmlLimitedBots` is passed to server as serialized config in string format // `htmlLimitedBots` is passed to server as serialized config in string format
......
...@@ -567,6 +567,7 @@ export async function isPageStatic({ ...@@ -567,6 +567,7 @@ export async function isPageStatic({
page, page,
distDir, distDir,
configFileName, configFileName,
runtimeEnvConfig,
httpAgentOptions, httpAgentOptions,
locales, locales,
defaultLocale, defaultLocale,
...@@ -593,6 +594,7 @@ export async function isPageStatic({ ...@@ -593,6 +594,7 @@ export async function isPageStatic({
cacheComponents: boolean cacheComponents: boolean
authInterrupts: boolean authInterrupts: boolean
configFileName: string configFileName: string
runtimeEnvConfig: any
httpAgentOptions: NextConfigComplete['httpAgentOptions'] httpAgentOptions: NextConfigComplete['httpAgentOptions']
locales?: readonly string[] locales?: readonly string[]
defaultLocale?: string defaultLocale?: string
...@@ -642,6 +644,9 @@ export async function isPageStatic({ ...@@ -642,6 +644,9 @@ export async function isPageStatic({
const isPageStaticSpan = trace('is-page-static-utils', parentId) const isPageStaticSpan = trace('is-page-static-utils', parentId)
return isPageStaticSpan return isPageStaticSpan
.traceAsyncFn(async (): Promise<PageIsStaticResult> => { .traceAsyncFn(async (): Promise<PageIsStaticResult> => {
;(
require('../shared/lib/runtime-config.external') as typeof import('../shared/lib/runtime-config.external')
).setConfig(runtimeEnvConfig)
setHttpClientAndAgentOptions({ setHttpClientAndAgentOptions({
httpAgentOptions, httpAgentOptions,
}) })
...@@ -950,14 +955,20 @@ export function reduceAppConfig( ...@@ -950,14 +955,20 @@ export function reduceAppConfig(
export async function hasCustomGetInitialProps({ export async function hasCustomGetInitialProps({
page, page,
distDir, distDir,
runtimeEnvConfig,
checkingApp, checkingApp,
sriEnabled, sriEnabled,
}: { }: {
page: string page: string
distDir: string distDir: string
runtimeEnvConfig: any
checkingApp: boolean checkingApp: boolean
sriEnabled: boolean sriEnabled: boolean
}): Promise<boolean> { }): Promise<boolean> {
;(
require('../shared/lib/runtime-config.external') as typeof import('../shared/lib/runtime-config.external')
).setConfig(runtimeEnvConfig)
const { ComponentMod } = await loadComponents({ const { ComponentMod } = await loadComponents({
distDir, distDir,
page: page, page: page,
...@@ -980,12 +991,17 @@ export async function hasCustomGetInitialProps({ ...@@ -980,12 +991,17 @@ export async function hasCustomGetInitialProps({
export async function getDefinedNamedExports({ export async function getDefinedNamedExports({
page, page,
distDir, distDir,
runtimeEnvConfig,
sriEnabled, sriEnabled,
}: { }: {
page: string page: string
distDir: string distDir: string
runtimeEnvConfig: any
sriEnabled: boolean sriEnabled: boolean
}): Promise<ReadonlyArray<string>> { }): Promise<ReadonlyArray<string>> {
;(
require('../shared/lib/runtime-config.external') as typeof import('../shared/lib/runtime-config.external')
).setConfig(runtimeEnvConfig)
const { ComponentMod } = await loadComponents({ const { ComponentMod } = await loadComponents({
distDir, distDir,
page: page, page: page,
......
...@@ -20,6 +20,7 @@ import { ...@@ -20,6 +20,7 @@ import {
urlQueryToSearchParams, urlQueryToSearchParams,
assign, assign,
} from '../shared/lib/router/utils/querystring' } from '../shared/lib/router/utils/querystring'
import { setConfig } from '../shared/lib/runtime-config.external'
import { getURL, loadGetInitialProps, ST } from '../shared/lib/utils' import { getURL, loadGetInitialProps, ST } from '../shared/lib/utils'
import type { NextWebVitalsMetric, NEXT_DATA } from '../shared/lib/utils' import type { NextWebVitalsMetric, NEXT_DATA } from '../shared/lib/utils'
import { Portal } from './portal' import { Portal } from './portal'
...@@ -211,6 +212,12 @@ export async function initialize(opts: { devClient?: any } = {}): Promise<{ ...@@ -211,6 +212,12 @@ export async function initialize(opts: { devClient?: any } = {}): Promise<{
// So, this is how we do it in the client side at runtime // So, this is how we do it in the client side at runtime
;(self as any).__next_set_public_path__(`${prefix}/_next/`) //eslint-disable-line ;(self as any).__next_set_public_path__(`${prefix}/_next/`) //eslint-disable-line
// Initialize next/config with the environment configuration
setConfig({
serverRuntimeConfig: {},
publicRuntimeConfig: initialData.runtimeConfig || {},
})
asPath = getURL() asPath = getURL()
// make sure not to attempt stripping basePath for 404s // make sure not to attempt stripping basePath for 404s
......
...@@ -422,6 +422,12 @@ async function exportAppImpl( ...@@ -422,6 +422,12 @@ async function exportAppImpl(
nextConfig.experimental.enablePrerenderSourceMaps === true, nextConfig.experimental.enablePrerenderSourceMaps === true,
} }
const { publicRuntimeConfig } = nextConfig
if (Object.keys(publicRuntimeConfig).length > 0) {
renderOpts.runtimeConfig = publicRuntimeConfig
}
// We need this for server rendering the Link component. // We need this for server rendering the Link component.
;(globalThis as any).__NEXT_DATA__ = { ;(globalThis as any).__NEXT_DATA__ = {
nextExport: true, nextExport: true,
......
...@@ -54,6 +54,7 @@ export interface ExportPageInput { ...@@ -54,6 +54,7 @@ export interface ExportPageInput {
ampValidatorPath?: string ampValidatorPath?: string
trailingSlash?: boolean trailingSlash?: boolean
buildExport?: boolean buildExport?: boolean
serverRuntimeConfig: { [key: string]: any }
subFolders?: boolean subFolders?: boolean
optimizeCss: any optimizeCss: any
disableOptimizedLoading: any disableOptimizedLoading: any
......
...@@ -50,6 +50,10 @@ import type { PagesRenderContext, PagesSharedContext } from '../server/render' ...@@ -50,6 +50,10 @@ import type { PagesRenderContext, PagesSharedContext } from '../server/render'
import type { AppSharedContext } from '../server/app-render/app-render' import type { AppSharedContext } from '../server/app-render/app-render'
import { MultiFileWriter } from '../lib/multi-file-writer' import { MultiFileWriter } from '../lib/multi-file-writer'
import { createRenderResumeDataCache } from '../server/resume-data-cache/resume-data-cache' import { createRenderResumeDataCache } from '../server/resume-data-cache/resume-data-cache'
const envConfig =
require('../shared/lib/runtime-config.external') as typeof import('../shared/lib/runtime-config.external')
;(globalThis as any).__NEXT_DATA__ = { ;(globalThis as any).__NEXT_DATA__ = {
nextExport: true, nextExport: true,
} }
...@@ -71,6 +75,7 @@ async function exportPageImpl( ...@@ -71,6 +75,7 @@ async function exportPageImpl(
distDir, distDir,
pagesDataDir, pagesDataDir,
buildExport = false, buildExport = false,
serverRuntimeConfig,
subFolders = false, subFolders = false,
optimizeCss, optimizeCss,
disableOptimizedLoading, disableOptimizedLoading,
...@@ -191,6 +196,11 @@ async function exportPageImpl( ...@@ -191,6 +196,11 @@ async function exportPageImpl(
addRequestMeta(req, 'isLocaleDomain', true) addRequestMeta(req, 'isLocaleDomain', true)
} }
envConfig.setConfig({
serverRuntimeConfig,
publicRuntimeConfig: commonRenderOpts.runtimeConfig,
})
const getHtmlFilename = (p: string) => const getHtmlFilename = (p: string) =>
subFolders ? `${p}${sep}index.html` : `${p}.html` subFolders ? `${p}${sep}index.html` : `${p}.html`
...@@ -406,6 +416,7 @@ export async function exportPages( ...@@ -406,6 +416,7 @@ export async function exportPages(
ampValidatorPath: ampValidatorPath:
nextConfig.experimental.amp?.validator || undefined, nextConfig.experimental.amp?.validator || undefined,
trailingSlash: nextConfig.trailingSlash, trailingSlash: nextConfig.trailingSlash,
serverRuntimeConfig: nextConfig.serverRuntimeConfig,
subFolders: nextConfig.trailingSlash && !options.buildExport, subFolders: nextConfig.trailingSlash && !options.buildExport,
buildExport: options.buildExport, buildExport: options.buildExport,
optimizeCss: nextConfig.experimental.optimizeCss, optimizeCss: nextConfig.experimental.optimizeCss,
......
...@@ -57,6 +57,7 @@ import { ...@@ -57,6 +57,7 @@ import {
UNDERSCORE_NOT_FOUND_ROUTE_ENTRY, UNDERSCORE_NOT_FOUND_ROUTE_ENTRY,
} from '../shared/lib/constants' } from '../shared/lib/constants'
import { isDynamicRoute } from '../shared/lib/router/utils' import { isDynamicRoute } from '../shared/lib/router/utils'
import { setConfig } from '../shared/lib/runtime-config.external'
import { execOnce } from '../shared/lib/utils' import { execOnce } from '../shared/lib/utils'
import { isBlockedPage } from './utils' import { isBlockedPage } from './utils'
import { getBotType, isBot } from '../shared/lib/router/utils/is-bot' import { getBotType, isBot } from '../shared/lib/router/utils/is-bot'
...@@ -474,7 +475,14 @@ export default abstract class Server< ...@@ -474,7 +475,14 @@ export default abstract class Server<
? new LocaleRouteNormalizer(this.i18nProvider) ? new LocaleRouteNormalizer(this.i18nProvider)
: undefined : undefined
const { assetPrefix, generateEtags } = this.nextConfig // Only serverRuntimeConfig needs the default
// publicRuntimeConfig gets it's default in client/index.js
const {
serverRuntimeConfig = {},
publicRuntimeConfig,
assetPrefix,
generateEtags,
} = this.nextConfig
this.buildId = this.getBuildId() this.buildId = this.getBuildId()
// this is a hack to avoid Webpack knowing this is equal to this.minimalMode // this is a hack to avoid Webpack knowing this is equal to this.minimalMode
...@@ -543,6 +551,12 @@ export default abstract class Server< ...@@ -543,6 +551,12 @@ export default abstract class Server<
? this.nextConfig.crossOrigin ? this.nextConfig.crossOrigin
: undefined, : undefined,
largePageDataBytes: this.nextConfig.experimental.largePageDataBytes, largePageDataBytes: this.nextConfig.experimental.largePageDataBytes,
// Only the `publicRuntimeConfig` key is exposed to the client side
// It'll be rendered as part of __NEXT_DATA__ on the client side
runtimeConfig:
Object.keys(publicRuntimeConfig).length > 0
? publicRuntimeConfig
: undefined,
isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile, isExperimentalCompile: this.nextConfig.experimental.isExperimentalCompile,
// `htmlLimitedBots` is passed to server as serialized config in string format // `htmlLimitedBots` is passed to server as serialized config in string format
...@@ -569,6 +583,12 @@ export default abstract class Server< ...@@ -569,6 +583,12 @@ export default abstract class Server<
reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength, reactMaxHeadersLength: this.nextConfig.reactMaxHeadersLength,
} }
// Initialize next/config with the environment configuration
setConfig({
serverRuntimeConfig,
publicRuntimeConfig,
})
this.pagesManifest = this.getPagesManifest() this.pagesManifest = this.getPagesManifest()
this.appPathsManifest = this.getAppPathsManifest() this.appPathsManifest = this.getAppPathsManifest()
this.appPathRoutes = this.getAppPathRoutes() this.appPathRoutes = this.getAppPathRoutes()
......
...@@ -653,6 +653,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() => ...@@ -653,6 +653,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
pageExtensions: z.array(z.string()).min(1).optional(), pageExtensions: z.array(z.string()).min(1).optional(),
poweredByHeader: z.boolean().optional(), poweredByHeader: z.boolean().optional(),
productionBrowserSourceMaps: z.boolean().optional(), productionBrowserSourceMaps: z.boolean().optional(),
publicRuntimeConfig: z.record(z.string(), z.any()).optional(),
reactProductionProfiling: z.boolean().optional(), reactProductionProfiling: z.boolean().optional(),
reactStrictMode: z.boolean().nullable().optional(), reactStrictMode: z.boolean().nullable().optional(),
reactMaxHeadersLength: z.number().nonnegative().int().optional(), reactMaxHeadersLength: z.number().nonnegative().int().optional(),
...@@ -685,6 +686,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() => ...@@ -685,6 +686,7 @@ export const configSchema: zod.ZodType<NextConfig> = z.lazy(() =>
.catchall(z.any()) .catchall(z.any())
.optional(), .optional(),
serverExternalPackages: z.array(z.string()).optional(), serverExternalPackages: z.array(z.string()).optional(),
serverRuntimeConfig: z.record(z.string(), z.any()).optional(),
skipMiddlewareUrlNormalize: z.boolean().optional(), skipMiddlewareUrlNormalize: z.boolean().optional(),
skipTrailingSlashRedirect: z.boolean().optional(), skipTrailingSlashRedirect: z.boolean().optional(),
staticPageGenerationTimeout: z.number().optional(), staticPageGenerationTimeout: z.number().optional(),
......
...@@ -1115,6 +1115,20 @@ export interface NextConfig { ...@@ -1115,6 +1115,20 @@ export interface NextConfig {
*/ */
reactMaxHeadersLength?: number reactMaxHeadersLength?: number
/**
* Add public (in browser) runtime configuration to your app
*
* @see [Runtime configuration](https://nextjs.org/docs/pages/api-reference/config/next-config-js/runtime-configuration
*/
publicRuntimeConfig?: { [key: string]: any }
/**
* Add server runtime configuration to your app
*
* @see [Runtime configuration](https://nextjs.org/docs/pages/api-reference/config/next-config-js/runtime-configuration
*/
serverRuntimeConfig?: { [key: string]: any }
/** /**
* Next.js enables HTTP Keep-Alive by default. * Next.js enables HTTP Keep-Alive by default.
* You may want to disable HTTP Keep-Alive for certain `fetch()` calls or globally. * You may want to disable HTTP Keep-Alive for certain `fetch()` calls or globally.
...@@ -1353,6 +1367,8 @@ export const defaultConfig = Object.freeze({ ...@@ -1353,6 +1367,8 @@ export const defaultConfig = Object.freeze({
i18n: null, i18n: null,
productionBrowserSourceMaps: false, productionBrowserSourceMaps: false,
excludeDefaultMomentLocales: true, excludeDefaultMomentLocales: true,
serverRuntimeConfig: {},
publicRuntimeConfig: {},
reactProductionProfiling: false, reactProductionProfiling: false,
reactStrictMode: null, reactStrictMode: null,
reactMaxHeadersLength: 6000, reactMaxHeadersLength: 6000,
......
...@@ -804,7 +804,12 @@ export default class DevServer extends Server { ...@@ -804,7 +804,12 @@ export default class DevServer extends Server {
// from waiting on them for the page to load in dev mode // from waiting on them for the page to load in dev mode
const __getStaticPaths = async () => { const __getStaticPaths = async () => {
const { configFileName, httpAgentOptions } = this.nextConfig const {
configFileName,
publicRuntimeConfig,
serverRuntimeConfig,
httpAgentOptions,
} = this.nextConfig
const { locales, defaultLocale } = this.nextConfig.i18n || {} const { locales, defaultLocale } = this.nextConfig.i18n || {}
const staticPathsWorker = this.getStaticPathsWorker() const staticPathsWorker = this.getStaticPathsWorker()
...@@ -816,6 +821,8 @@ export default class DevServer extends Server { ...@@ -816,6 +821,8 @@ export default class DevServer extends Server {
config: { config: {
pprConfig: this.nextConfig.experimental.ppr, pprConfig: this.nextConfig.experimental.ppr,
configFileName, configFileName,
publicRuntimeConfig,
serverRuntimeConfig,
cacheComponents: Boolean( cacheComponents: Boolean(
this.nextConfig.experimental.cacheComponents this.nextConfig.experimental.cacheComponents
), ),
......
...@@ -25,6 +25,8 @@ import type { AppRouteRouteModule } from '../route-modules/app-route/module' ...@@ -25,6 +25,8 @@ import type { AppRouteRouteModule } from '../route-modules/app-route/module'
type RuntimeConfig = { type RuntimeConfig = {
pprConfig: ExperimentalPPRConfig | undefined pprConfig: ExperimentalPPRConfig | undefined
configFileName: string configFileName: string
publicRuntimeConfig: { [key: string]: any }
serverRuntimeConfig: { [key: string]: any }
cacheComponents: boolean cacheComponents: boolean
} }
...@@ -90,6 +92,9 @@ export async function loadStaticPaths({ ...@@ -90,6 +92,9 @@ export async function loadStaticPaths({
}) })
// update work memory runtime-config // update work memory runtime-config
;(
require('../../shared/lib/runtime-config.external') as typeof import('../../shared/lib/runtime-config.external')
).setConfig(config)
setHttpClientAndAgentOptions({ setHttpClientAndAgentOptions({
httpAgentOptions, httpAgentOptions,
}) })
......
...@@ -28,6 +28,8 @@ export type RouterServerContext = Record< ...@@ -28,6 +28,8 @@ export type RouterServerContext = Record<
parsedUrl?: UrlWithParsedQuery, parsedUrl?: UrlWithParsedQuery,
setHeaders?: boolean setHeaders?: boolean
) => Promise<void> ) => Promise<void>
// current loaded public runtime config
publicRuntimeConfig?: NextConfigComplete['publicRuntimeConfig']
// exposing nextConfig for dev mode specifically // exposing nextConfig for dev mode specifically
nextConfig?: NextConfigComplete nextConfig?: NextConfigComplete
// whether running in custom server mode // whether running in custom server mode
......
...@@ -243,6 +243,7 @@ function renderPageTree( ...@@ -243,6 +243,7 @@ function renderPageTree(
export type RenderOptsPartial = { export type RenderOptsPartial = {
canonicalBase: string canonicalBase: string
runtimeConfig?: { [key: string]: any }
assetPrefix?: string assetPrefix?: string
err?: Error | null err?: Error | null
nextExport?: boolean nextExport?: boolean
...@@ -1490,6 +1491,7 @@ export async function renderToHTMLImpl( ...@@ -1490,6 +1491,7 @@ export async function renderToHTMLImpl(
domainLocales, domainLocales,
locale, locale,
locales, locales,
runtimeConfig,
} = renderOpts } = renderOpts
const htmlProps: HtmlProps = { const htmlProps: HtmlProps = {
__NEXT_DATA__: { __NEXT_DATA__: {
...@@ -1498,6 +1500,7 @@ export async function renderToHTMLImpl( ...@@ -1498,6 +1500,7 @@ export async function renderToHTMLImpl(
query, // querystring parsed / passed by the user query, // querystring parsed / passed by the user
buildId: sharedContext.buildId, buildId: sharedContext.buildId,
assetPrefix: assetPrefix === '' ? undefined : assetPrefix, // send assetPrefix to the client side when configured, otherwise don't sent in the resulting HTML assetPrefix: assetPrefix === '' ? undefined : assetPrefix, // send assetPrefix to the client side when configured, otherwise don't sent in the resulting HTML
runtimeConfig, // runtimeConfig if provided, otherwise don't sent in the resulting HTML
nextExport: nextExport === true ? true : undefined, // If this is a page exported by `next export` nextExport: nextExport === true ? true : undefined, // If this is a page exported by `next export`
autoExport: isAutoExport === true ? true : undefined, // If this is an auto exported page autoExport: isAutoExport === true ? true : undefined, // If this is an auto exported page
isFallback, isFallback,
......
...@@ -204,6 +204,10 @@ export const getHandler = ({ ...@@ -204,6 +204,10 @@ export const getHandler = ({
query: hasStaticProps ? {} : originalQuery, query: hasStaticProps ? {} : originalQuery,
}) })
const publicRuntimeConfig: Record<string, string> =
routerServerContext?.publicRuntimeConfig ||
nextConfig.publicRuntimeConfig
const handleResponse = async (span?: Span) => { const handleResponse = async (span?: Span) => {
const responseGenerator: ResponseGenerator = async ({ const responseGenerator: ResponseGenerator = async ({
previousCacheEntry, previousCacheEntry,
...@@ -278,6 +282,12 @@ export const getHandler = ({ ...@@ -278,6 +282,12 @@ export const getHandler = ({
nextConfig.experimental.disableOptimizedLoading, nextConfig.experimental.disableOptimizedLoading,
largePageDataBytes: largePageDataBytes:
nextConfig.experimental.largePageDataBytes, nextConfig.experimental.largePageDataBytes,
// Only the `publicRuntimeConfig` key is exposed to the client side
// It'll be rendered as part of __NEXT_DATA__ on the client side
runtimeConfig:
Object.keys(publicRuntimeConfig).length > 0
? publicRuntimeConfig
: undefined,
isExperimentalCompile, isExperimentalCompile,
......
let runtimeConfig: any
export default () => {
return runtimeConfig
}
export function setConfig(configValue: any): void {
runtimeConfig = configValue
}
...@@ -91,6 +91,7 @@ export type NEXT_DATA = { ...@@ -91,6 +91,7 @@ export type NEXT_DATA = {
query: ParsedUrlQuery query: ParsedUrlQuery
buildId: string buildId: string
assetPrefix?: string assetPrefix?: string
runtimeConfig?: { [key: string]: any }
nextExport?: boolean nextExport?: boolean
autoExport?: boolean autoExport?: boolean
isFallback?: boolean isFallback?: boolean
......
...@@ -4,6 +4,12 @@ export default { ...@@ -4,6 +4,12 @@ export default {
maxInactiveAge: 1000 * 60 * 60, maxInactiveAge: 1000 * 60 * 60,
}, },
poweredByHeader: false, poweredByHeader: false,
serverRuntimeConfig: {
mySecret: 'secret',
},
publicRuntimeConfig: {
staticFolder: '/static',
},
env: { env: {
customVar: 'hello', customVar: 'hello',
}, },
......
import getConfig from 'next/config'
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
export default () => ( export default () => (
<div> <div>
<p id="server-only">server-only: {serverRuntimeConfig.mySecret || '***'}</p>
<p id="server-and-client">{publicRuntimeConfig.staticFolder}</p>
<p id="env">{process.env.customVar}</p> <p id="env">{process.env.customVar}</p>
</div> </div>
) )
...@@ -44,16 +44,32 @@ describe('Configuration', () => { ...@@ -44,16 +44,32 @@ describe('Configuration', () => {
expect(header).not.toBe('Next.js') expect(header).not.toBe('Next.js')
}) })
test('renders server config on the server only', async () => {
const $ = await get$('/next-config')
expect($('#server-only').text()).toBe('server-only: secret')
})
test('renders public config on the server only', async () => {
const $ = await get$('/next-config')
expect($('#server-and-client').text()).toBe('/static')
})
test('correctly imports a package that defines `module` but no `main` in package.json', async () => { test('correctly imports a package that defines `module` but no `main` in package.json', async () => {
const $ = await get$('/module-only-content') const $ = await get$('/module-only-content')
expect($('#messageInAPackage').text()).toBe('OK') expect($('#messageInAPackage').text()).toBe('OK')
}) })
it('should have env variables available on the client', async () => { it('should have config available on the client', async () => {
const browser = await webdriver(context.appPort, '/next-config') const browser = await webdriver(context.appPort, '/next-config')
const serverText = await browser.elementByCss('#server-only').text()
const serverClientText = await browser
.elementByCss('#server-and-client')
.text()
const envValue = await browser.elementByCss('#env').text() const envValue = await browser.elementByCss('#env').text()
expect(serverText).toBe('server-only: ***')
expect(serverClientText).toBe('/static')
expect(envValue).toBe('hello') expect(envValue).toBe('hello')
await browser.close() await browser.close()
}) })
......
...@@ -4,6 +4,12 @@ module.exports = { ...@@ -4,6 +4,12 @@ module.exports = {
maxInactiveAge: 1000 * 60 * 60, maxInactiveAge: 1000 * 60 * 60,
}, },
poweredByHeader: false, poweredByHeader: false,
serverRuntimeConfig: {
mySecret: 'secret',
},
publicRuntimeConfig: {
staticFolder: '/static',
},
env: { env: {
customVar: 'hello', customVar: 'hello',
}, },
......
import getConfig from 'next/config'
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
export default () => ( export default () => (
<div> <div>
<p id="server-only">server-only: {serverRuntimeConfig.mySecret || '***'}</p>
<p id="server-and-client">{publicRuntimeConfig.staticFolder}</p>
<p id="env">{process.env.customVar}</p> <p id="env">{process.env.customVar}</p>
</div> </div>
) )
...@@ -44,16 +44,32 @@ describe('Configuration', () => { ...@@ -44,16 +44,32 @@ describe('Configuration', () => {
expect(header).not.toBe('Next.js') expect(header).not.toBe('Next.js')
}) })
test('renders server config on the server only', async () => {
const $ = await get$('/next-config')
expect($('#server-only').text()).toBe('server-only: secret')
})
test('renders public config on the server only', async () => {
const $ = await get$('/next-config')
expect($('#server-and-client').text()).toBe('/static')
})
test('correctly imports a package that defines `module` but no `main` in package.json', async () => { test('correctly imports a package that defines `module` but no `main` in package.json', async () => {
const $ = await get$('/module-only-content') const $ = await get$('/module-only-content')
expect($('#messageInAPackage').text()).toBe('OK') expect($('#messageInAPackage').text()).toBe('OK')
}) })
it('should have env variables available on the client', async () => { it('should have config available on the client', async () => {
const browser = await webdriver(context.appPort, '/next-config') const browser = await webdriver(context.appPort, '/next-config')
const serverText = await browser.elementByCss('#server-only').text()
const serverClientText = await browser
.elementByCss('#server-and-client')
.text()
const envValue = await browser.elementByCss('#env').text() const envValue = await browser.elementByCss('#env').text()
expect(serverText).toBe('server-only: ***')
expect(serverClientText).toBe('/static')
expect(envValue).toBe('hello') expect(envValue).toBe('hello')
await browser.close() await browser.close()
}) })
......
import getConfig from 'next/config'
const { serverRuntimeConfig, publicRuntimeConfig } = getConfig()
const Layout = ({ children }) => {
return (
<div>
<p id="server-runtime-config">{JSON.stringify(serverRuntimeConfig)}</p>
<p id="public-runtime-config">{JSON.stringify(publicRuntimeConfig)}</p>
<div>{children}</div>
</div>
)
}
export default Layout
import Layout from './../components/Layout'
const App = ({ Component, pageProps }) => {
return (
<Layout>
<Component {...pageProps} />
</Layout>
)
}
export default App
const Post = () => {
return (
<div>
<h2>POST</h2>
</div>
)
}
export const getStaticProps = async () => {
return {
props: {},
}
}
export const getStaticPaths = async () => {
return {
paths: ['/post/1', '/post/2'],
fallback: true,
}
}
export default Post
/* eslint-env jest */
import fs from 'fs-extra'
import { join } from 'path'
import cheerio from 'cheerio'
import {
findPort,
renderViaHTTP,
launchApp,
waitFor,
killApp,
} from 'next-test-utils'
const appDir = join(__dirname, '../')
const nextConfig = join(appDir, 'next.config.js')
const runApp = async (config) => {
const port = await findPort()
let stderr = ''
const app = await launchApp(appDir, port, {
onStderr(err) {
stderr += err
},
})
const html = await renderViaHTTP(port, '/post/1')
const $ = cheerio.load(html)
await waitFor(1000)
await killApp(app)
await fs.remove(nextConfig)
expect(stderr).not.toMatch(
/Cannot read property 'serverRuntimeConfig' of undefined/i
)
expect(JSON.parse($('#server-runtime-config').text())).toEqual(
config.serverRuntimeConfig || {}
)
expect(JSON.parse($('#public-runtime-config').text())).toEqual(
config.publicRuntimeConfig || {}
)
}
describe('should work with runtime-config in next.config.js', () => {
test('empty runtime-config', async () => {
await fs.writeFile(
nextConfig,
`
module.exports = {
}
`
)
await runApp({})
})
test('with runtime-config', async () => {
const config = {
serverRuntimeConfig: {
mySecret: '**********',
},
publicRuntimeConfig: {
staticFolder: '/static',
},
}
await fs.writeFile(
nextConfig,
`
module.exports = ${JSON.stringify(config)}
`
)
await runApp(config)
})
})
...@@ -185,7 +185,7 @@ describe('static export', () => { ...@@ -185,7 +185,7 @@ describe('static export', () => {
.elementByCss('#about-page p') .elementByCss('#about-page p')
.text() .text()
expect(text).toBe('This is the About page') expect(text).toBe('This is the About page foo')
await browser.close() await browser.close()
}) })
...@@ -198,7 +198,7 @@ describe('static export', () => { ...@@ -198,7 +198,7 @@ describe('static export', () => {
.elementByCss('#about-page p') .elementByCss('#about-page p')
.text() .text()
expect(text).toBe('This is the About page') expect(text).toBe('This is the About page foo')
await browser.close() await browser.close()
}) })
...@@ -396,7 +396,7 @@ describe('static export', () => { ...@@ -396,7 +396,7 @@ describe('static export', () => {
it('should render the about page', async () => { it('should render the about page', async () => {
const html = await renderViaHTTP(port, '/about') const html = await renderViaHTTP(port, '/about')
expect(html).toMatch(/This is the About page/) expect(html).toMatch(/This is the About page foobar/)
}) })
it('should render links correctly', async () => { it('should render links correctly', async () => {
...@@ -456,7 +456,7 @@ describe('static export', () => { ...@@ -456,7 +456,7 @@ describe('static export', () => {
it('Should serve public files', async () => { it('Should serve public files', async () => {
const html = await renderViaHTTP(port, '/about') const html = await renderViaHTTP(port, '/about')
const data = await renderViaHTTP(port, '/about/data.txt') const data = await renderViaHTTP(port, '/about/data.txt')
expect(html).toMatch(/This is the About page/) expect(html).toMatch(/This is the About page foobar/)
expect(data).toBe('data') expect(data).toBe('data')
}) })
......
...@@ -2,6 +2,12 @@ module.exports = (phase) => { ...@@ -2,6 +2,12 @@ module.exports = (phase) => {
return { return {
output: 'export', output: 'export',
distDir: 'out', distDir: 'out',
publicRuntimeConfig: {
foo: 'foo',
},
serverRuntimeConfig: {
bar: 'bar',
},
trailingSlash: true, trailingSlash: true,
exportPathMap: function () { exportPathMap: function () {
return { return {
......
import Link from 'next/link' import Link from 'next/link'
import getConfig from 'next/config'
const { publicRuntimeConfig, serverRuntimeConfig } = getConfig()
const About = () => ( const About = ({ bar }) => (
<div id="about-page"> <div id="about-page">
<div> <div>
<Link href="/">Go Back</Link> <Link href="/">Go Back</Link>
</div> </div>
<p>This is the About page</p> <p>{`This is the About page ${publicRuntimeConfig.foo}${bar || ''}`}</p>
</div> </div>
) )
About.getInitialProps = async (ctx) => {
return { bar: serverRuntimeConfig.bar }
}
export default About export default About
...@@ -309,6 +309,7 @@ const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18 ...@@ -309,6 +309,7 @@ const isReact18 = parseInt(process.env.NEXT_TEST_REACT_VERSION) === 18
"/node_modules/next/dist/shared/lib/is-plain-object.js", "/node_modules/next/dist/shared/lib/is-plain-object.js",
"/node_modules/next/dist/shared/lib/is-thenable.js", "/node_modules/next/dist/shared/lib/is-thenable.js",
"/node_modules/next/dist/shared/lib/no-fallback-error.external.js", "/node_modules/next/dist/shared/lib/no-fallback-error.external.js",
"/node_modules/next/dist/shared/lib/runtime-config.external.js",
"/node_modules/next/dist/shared/lib/server-reference-info.js", "/node_modules/next/dist/shared/lib/server-reference-info.js",
"/node_modules/react/cjs/react.production.js", "/node_modules/react/cjs/react.production.js",
"/node_modules/react/index.js", "/node_modules/react/index.js",
......
import getConfig from 'next/config'
const page = () => {
const { publicRuntimeConfig, serverRuntimeConfig } = getConfig()
return (
<>
{publicRuntimeConfig && <p>found public config</p>}
{serverRuntimeConfig && <p>found server config</p>}
</>
)
}
page.getInitialProps = () => ({})
export default page
...@@ -938,6 +938,19 @@ describe('Production Usage', () => { ...@@ -938,6 +938,19 @@ describe('Production Usage', () => {
}) })
} }
it('should have default runtime values when not defined', async () => {
const html = await renderViaHTTP(next.appPort, '/runtime-config')
expect(html).toMatch(/found public config/)
expect(html).toMatch(/found server config/)
})
it('should not have runtimeConfig in __NEXT_DATA__', async () => {
const html = await renderViaHTTP(next.appPort, '/runtime-config')
const $ = cheerio.load(html)
const script = $('#__NEXT_DATA__').html()
expect(script).not.toMatch(/runtimeConfig/)
})
it('should add autoExport for auto pre-rendered pages', async () => { it('should add autoExport for auto pre-rendered pages', async () => {
for (const page of ['/about']) { for (const page of ['/about']) {
const html = await renderViaHTTP(next.appPort, page) const html = await renderViaHTTP(next.appPort, page)
......
...@@ -4,6 +4,7 @@ import 'next/app' ...@@ -4,6 +4,7 @@ import 'next/app'
// import 'next/babel'; // import 'next/babel';
import 'next/cache' import 'next/cache'
import 'next/client' import 'next/client'
import 'next/config'
import 'next/constants' import 'next/constants'
import 'next/document' import 'next/document'
import 'next/dynamic' import 'next/dynamic'
......
...@@ -12397,6 +12397,16 @@ ...@@ -12397,6 +12397,16 @@
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/integration/development-runtime-config/test/index.test.js": {
"passed": [
"should work with runtime-config in next.config.js empty runtime-config",
"should work with runtime-config in next.config.js with runtime-config"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/integration/disable-js/test/index.test.js": { "test/integration/disable-js/test/index.test.js": {
"passed": [ "passed": [
"disabled runtime JS production mode should not have __NEXT_DATA__ script", "disabled runtime JS production mode should not have __NEXT_DATA__ script",
...@@ -20975,6 +20985,7 @@ ...@@ -20975,6 +20985,7 @@
"Production Usage Misc should handle already finished responses", "Production Usage Misc should handle already finished responses",
"Production Usage Misc should have default runtime values when not defined", "Production Usage Misc should have default runtime values when not defined",
"Production Usage Misc should not add autoExport for non pre-rendered pages", "Production Usage Misc should not add autoExport for non pre-rendered pages",
"Production Usage Misc should not have runtimeConfig in __NEXT_DATA__",
"Production Usage Misc should reload the page on page script error", "Production Usage Misc should reload the page on page script error",
"Production Usage Misc should reload the page on page script error with prefetch", "Production Usage Misc should reload the page on page script error with prefetch",
"Production Usage Runtime errors should call getInitialProps on _error page during a client side component error", "Production Usage Runtime errors should call getInitialProps on _error page during a client side component error",
...@@ -14140,6 +14140,16 @@ ...@@ -14140,6 +14140,16 @@
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/integration/development-runtime-config/test/index.test.js": {
"passed": [
"should work with runtime-config in next.config.js empty runtime-config",
"should work with runtime-config in next.config.js with runtime-config"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/integration/disable-js/test/index.test.js": { "test/integration/disable-js/test/index.test.js": {
"passed": [ "passed": [
"disabled runtime JS development mode should have a script for each preload link", "disabled runtime JS development mode should have a script for each preload link",
...@@ -11002,6 +11002,16 @@ ...@@ -11002,6 +11002,16 @@
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/integration/development-runtime-config/test/index.test.js": {
"passed": [
"should work with runtime-config in next.config.js empty runtime-config",
"should work with runtime-config in next.config.js with runtime-config"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/integration/disable-js/test/index.test.js": { "test/integration/disable-js/test/index.test.js": {
"passed": [ "passed": [
"disabled runtime JS production mode should not have __NEXT_DATA__ script", "disabled runtime JS production mode should not have __NEXT_DATA__ script",
...@@ -19406,6 +19416,7 @@ ...@@ -19406,6 +19416,7 @@
"Production Usage Misc should handle already finished responses", "Production Usage Misc should handle already finished responses",
"Production Usage Misc should have default runtime values when not defined", "Production Usage Misc should have default runtime values when not defined",
"Production Usage Misc should not add autoExport for non pre-rendered pages", "Production Usage Misc should not add autoExport for non pre-rendered pages",
"Production Usage Misc should not have runtimeConfig in __NEXT_DATA__",
"Production Usage Misc should reload the page on page script error", "Production Usage Misc should reload the page on page script error",
"Production Usage Misc should reload the page on page script error with prefetch", "Production Usage Misc should reload the page on page script error with prefetch",
"Production Usage Runtime errors should call getInitialProps on _error page during a client side component error", "Production Usage Runtime errors should call getInitialProps on _error page during a client side component error",
...@@ -14549,6 +14549,16 @@ ...@@ -14549,6 +14549,16 @@
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
"test/integration/development-runtime-config/test/index.test.js": {
"passed": [
"should work with runtime-config in next.config.js empty runtime-config",
"should work with runtime-config in next.config.js with runtime-config"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": false
},
"test/integration/disable-js/test/index.test.js": { "test/integration/disable-js/test/index.test.js": {
"passed": [ "passed": [
"disabled runtime JS development mode should have a script for each preload link", "disabled runtime JS development mode should have a script for each preload link",
...@@ -2735,6 +2735,7 @@ module.exports = /******/ (function (modules) { ...@@ -2735,6 +2735,7 @@ module.exports = /******/ (function (modules) {
const { processEnv } = __webpack_require__('4VNc') const { processEnv } = __webpack_require__('4VNc')
processEnv([]) processEnv([])
const runtimeConfig = {}
const { parse } = __webpack_require__('bzos') const { parse } = __webpack_require__('bzos')
const { parse: parseQs } = __webpack_require__('8xkj') const { parse: parseQs } = __webpack_require__('8xkj')
const { renderToHTML } = __webpack_require__('KK5V') const { renderToHTML } = __webpack_require__('KK5V')
...@@ -2821,6 +2822,7 @@ module.exports = /******/ (function (modules) { ...@@ -2821,6 +2822,7 @@ module.exports = /******/ (function (modules) {
canonicalBase: '', canonicalBase: '',
buildId: 'xXPgpxsbhoEyVP2leRiec', buildId: 'xXPgpxsbhoEyVP2leRiec',
assetPrefix: '', assetPrefix: '',
runtimeConfig: runtimeConfig.publicRuntimeConfig || {},
previewProps: { previewProps: {
previewModeId: '9e0f19a11fe1be22878bdb16da136d9e', previewModeId: '9e0f19a11fe1be22878bdb16da136d9e',
previewModeSigningKey: previewModeSigningKey:
......
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