diff --git a/packages/nuxt3/src/app/compat/legacy-app.ts b/packages/nuxt3/src/app/compat/legacy-app.ts index d160a88800..2c77f9cf53 100644 --- a/packages/nuxt3/src/app/compat/legacy-app.ts +++ b/packages/nuxt3/src/app/compat/legacy-app.ts @@ -114,6 +114,12 @@ const todo = new Set([ 'beforeSerialize' ]) +const serverProperties = new Set([ + 'req', + 'res', + 'ssrContext' +]) + const routerKeys: Array = ['route', 'params', 'query'] const staticFlags = { @@ -159,6 +165,10 @@ export const legacyPlugin = (nuxtApp: NuxtApp) => { return staticFlags[p] } + if (process.client && serverProperties.has(p)) { + return undefined + } + if (p === 'ssrContext') { return nuxt._legacyContext }