fix(schema): handle null/undefined values in runtimeConfig (#2456)

This commit is contained in:
Daniel Roe 2021-12-20 12:19:31 +00:00 committed by GitHub
parent c288907f72
commit c824905b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -14,6 +14,7 @@ import wasmPlugin from '@rollup/plugin-wasm'
import inject from '@rollup/plugin-inject'
import { visualizer } from 'rollup-plugin-visualizer'
import * as unenv from 'unenv'
import devalue from '@nuxt/devalue'
import type { Preset } from 'unenv'
import { sanitizeFilePath } from 'mlly'
@ -164,7 +165,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
'process.env.NUXT_STATIC_VERSION': JSON.stringify(nitroContext._nuxt.staticAssets.version),
'process.env.NUXT_FULL_STATIC': nitroContext._nuxt.fullStatic as unknown as string,
'process.env.NITRO_PRESET': JSON.stringify(nitroContext.preset),
'process.env.RUNTIME_CONFIG': JSON.stringify(nitroContext._nuxt.runtimeConfig),
'process.env.RUNTIME_CONFIG': devalue(nitroContext._nuxt.runtimeConfig),
'process.env.DEBUG': JSON.stringify(nitroContext._nuxt.dev)
}
}))

View File

@ -714,6 +714,6 @@ export default {
* @version 3
*/
publicRuntimeConfig: {
$resolve: (val, get) => defu(val, { app: get('app') })
$resolve: (val = {}, get) => ({ ...val, app: defu(val.app, get('app')) })
},
}