nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

"NuxtPage / NuxtLayout component has not been used" warn when NuxtLayout async show up

Open serkodev opened this issue 4 months ago • 5 comments

Environment

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.10.2
  • CLI Version: 3.10.1
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-2vasos?file=app.vue

Describe the bug

I used <NuxtPage /> and <NuxtLayout /> components in the below way:

    <div v-if="loading">loading...</div>
    <NuxtLayout v-else>
      <NuxtPage />
    </NuxtLayout>

But it shows up the below warning in console log.

[nuxt] Your project has pages but the `<NuxtPage />` component has not been used. You might be using the `<RouterView />` component instead, which will not work correctly in Nuxt. You can set `pages: false` in `nuxt.config` if you do not wish to use the Nuxt `vue-router` integration.
[nuxt] Your project has layouts but the `<NuxtLayout />` component has not been used.

Additional context

My purpose is fetching some environment data from server before NuxtLayout and NuxtPage rendered and shows a loading layout. In addition, I will use it with SSR off.

Logs

No response

serkodev avatar Feb 22 '24 12:02 serkodev

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

stackblitz[bot] avatar Feb 22 '24 12:02 stackblitz[bot]

Yup, that's not detected by the current warning process. You can ignore that one for now 😋

manniL avatar Feb 22 '24 12:02 manniL

I'm also getting this error in a Nuxt Ionic App. In this case I am not using NuxtPage, because I'm using ion-router which I assume uses NuxtPage. Any way to disable this false positive warning?

image

abarke avatar May 06 '24 08:05 abarke