mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt3)!: preserve runtime-config structure for client-side (#4267)
This commit is contained in:
parent
0d5ec20a4b
commit
4d1a6ba6ce
@ -120,8 +120,12 @@ export function createNuxtApp (options: CreateOptions) {
|
||||
|
||||
// Expose runtime config
|
||||
if (process.server) {
|
||||
nuxtApp.provide('config', options.ssrContext.runtimeConfig.private)
|
||||
nuxtApp.payload.config = options.ssrContext.runtimeConfig.public
|
||||
nuxtApp.provide('config', options.ssrContext.runtimeConfig)
|
||||
// Client's runtime-config
|
||||
nuxtApp.payload.config = {
|
||||
public: options.ssrContext.runtimeConfig.public,
|
||||
app: options.ssrContext.runtimeConfig.app
|
||||
}
|
||||
} else {
|
||||
nuxtApp.provide('config', reactive(nuxtApp.payload.config))
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ const getSPARenderer = cachedResult(async () => {
|
||||
ssrContext.nuxt = {
|
||||
serverRendered: false,
|
||||
config: {
|
||||
...config.public,
|
||||
public: config.public,
|
||||
app: config.app
|
||||
}
|
||||
}
|
||||
@ -84,13 +84,12 @@ export default eventHandler(async (event) => {
|
||||
}
|
||||
|
||||
// Initialize ssr context
|
||||
const config = useRuntimeConfig()
|
||||
const ssrContext = {
|
||||
url,
|
||||
event,
|
||||
req: event.req,
|
||||
res: event.res,
|
||||
runtimeConfig: { private: config, public: { ...config.public, app: config.app } },
|
||||
runtimeConfig: useRuntimeConfig(),
|
||||
noSSR: event.req.headers['x-nuxt-no-ssr'],
|
||||
|
||||
error: ssrError,
|
||||
|
Loading…
Reference in New Issue
Block a user