mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(schema): handle null/undefined values in runtimeConfig
(#2456)
This commit is contained in:
parent
c288907f72
commit
c824905b99
@ -14,6 +14,7 @@ import wasmPlugin from '@rollup/plugin-wasm'
|
|||||||
import inject from '@rollup/plugin-inject'
|
import inject from '@rollup/plugin-inject'
|
||||||
import { visualizer } from 'rollup-plugin-visualizer'
|
import { visualizer } from 'rollup-plugin-visualizer'
|
||||||
import * as unenv from 'unenv'
|
import * as unenv from 'unenv'
|
||||||
|
import devalue from '@nuxt/devalue'
|
||||||
|
|
||||||
import type { Preset } from 'unenv'
|
import type { Preset } from 'unenv'
|
||||||
import { sanitizeFilePath } from 'mlly'
|
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_STATIC_VERSION': JSON.stringify(nitroContext._nuxt.staticAssets.version),
|
||||||
'process.env.NUXT_FULL_STATIC': nitroContext._nuxt.fullStatic as unknown as string,
|
'process.env.NUXT_FULL_STATIC': nitroContext._nuxt.fullStatic as unknown as string,
|
||||||
'process.env.NITRO_PRESET': JSON.stringify(nitroContext.preset),
|
'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)
|
'process.env.DEBUG': JSON.stringify(nitroContext._nuxt.dev)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
@ -714,6 +714,6 @@ export default {
|
|||||||
* @version 3
|
* @version 3
|
||||||
*/
|
*/
|
||||||
publicRuntimeConfig: {
|
publicRuntimeConfig: {
|
||||||
$resolve: (val, get) => defu(val, { app: get('app') })
|
$resolve: (val = {}, get) => ({ ...val, app: defu(val.app, get('app')) })
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user