mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-12 11:48:17 +00:00
Merge branch 'main' into patch-21
This commit is contained in:
commit
da1db599cc
@ -558,6 +558,7 @@ export function defineAppConfig<C extends AppConfigInput> (config: C): C {
|
|||||||
/**
|
/**
|
||||||
* Configure error getter on runtime secret property access that doesn't exist on the client side
|
* Configure error getter on runtime secret property access that doesn't exist on the client side
|
||||||
*/
|
*/
|
||||||
|
const loggedKeys = new Set<string>()
|
||||||
function wrappedConfig (runtimeConfig: Record<string, unknown>) {
|
function wrappedConfig (runtimeConfig: Record<string, unknown>) {
|
||||||
if (!import.meta.dev || import.meta.server) { return runtimeConfig }
|
if (!import.meta.dev || import.meta.server) { return runtimeConfig }
|
||||||
const keys = Object.keys(runtimeConfig).map(key => `\`${key}\``)
|
const keys = Object.keys(runtimeConfig).map(key => `\`${key}\``)
|
||||||
@ -565,8 +566,11 @@ function wrappedConfig (runtimeConfig: Record<string, unknown>) {
|
|||||||
return new Proxy(runtimeConfig, {
|
return new Proxy(runtimeConfig, {
|
||||||
get (target, p, receiver) {
|
get (target, p, receiver) {
|
||||||
if (typeof p === 'string' && p !== 'public' && !(p in target) && !p.startsWith('__v') /* vue check for reactivity, e.g. `__v_isRef` */) {
|
if (typeof p === 'string' && p !== 'public' && !(p in target) && !p.startsWith('__v') /* vue check for reactivity, e.g. `__v_isRef` */) {
|
||||||
|
if (!loggedKeys.has(p)) {
|
||||||
|
loggedKeys.add(p)
|
||||||
console.warn(`[nuxt] Could not access \`${p}\`. The only available runtime config keys on the client side are ${keys.join(', ')} and ${lastKey}. See \`https://nuxt.com/docs/guide/going-further/runtime-config\` for more information.`)
|
console.warn(`[nuxt] Could not access \`${p}\`. The only available runtime config keys on the client side are ${keys.join(', ')} and ${lastKey}. See \`https://nuxt.com/docs/guide/going-further/runtime-config\` for more information.`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return Reflect.get(target, p, receiver)
|
return Reflect.get(target, p, receiver)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user