MCPcopy
hub / github.com/vercel/next.js / getNextConfigEnv

Function getNextConfigEnv

packages/next/src/lib/static-env.ts:40–54  ·  view source on GitHub ↗
(
  config: NextConfigComplete | NextConfigRuntime
)

Source from the content-addressed store, hash-verified

38 * Collects the `env` config value from the Next.js config.
39 */
40export function getNextConfigEnv(
41 config: NextConfigComplete | NextConfigRuntime
42) {
43 // Refactored code below to use for-of
44 const defineEnv: Record<string, string | undefined> = {}
45 const env = config.env
46 for (const key in env) {
47 const value = env[key]
48 if (value != null) {
49 errorIfEnvConflicted(config, key)
50 defineEnv[`process.env.${key}`] = value
51 }
52 }
53 return defineEnv
54}
55
56export function getStaticEnv(
57 config: NextConfigComplete | NextConfigRuntime,

Callers 2

inlineStaticEnvFunction · 0.90
getStaticEnvFunction · 0.85

Calls 1

errorIfEnvConflictedFunction · 0.85

Tested by

no test coverage detected