mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): don't warn for definePageMeta
in client-only pages (#28246)
This commit is contained in:
parent
3a72b9d1a4
commit
4d730545a9
@ -4,7 +4,13 @@ import ClientOnly from '#app/components/client-only'
|
||||
|
||||
/* @__NO_SIDE_EFFECTS__ */
|
||||
export const createClientPage = (loader: AsyncComponentLoader) => {
|
||||
const page = defineAsyncComponent(loader)
|
||||
const page = defineAsyncComponent(import.meta.dev
|
||||
? () => loader().then((m) => {
|
||||
// mark component as client-only for `definePageMeta`
|
||||
(m.default || m).__clientOnlyPage = true
|
||||
return m.default || m
|
||||
})
|
||||
: loader)
|
||||
|
||||
return defineComponent({
|
||||
inheritAttrs: false,
|
||||
|
@ -60,7 +60,7 @@ export const definePageMeta = (meta: PageMeta): void => {
|
||||
try {
|
||||
const isRouteComponent = component && useRoute().matched.some(p => Object.values(p.components || {}).includes(component))
|
||||
const isRenderingServerPage = import.meta.server && useNuxtApp().ssrContext?.islandContext
|
||||
if (isRouteComponent || isRenderingServerPage) {
|
||||
if (isRouteComponent || isRenderingServerPage || ((component as any)?.__clientOnlyPage)) {
|
||||
// don't warn if it's being used in a route component (or server page)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user