Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
serkodev opened this issue Feb 22, 2024 · 3 comments · May be fixed by #26289
Open

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

serkodev opened this issue Feb 22, 2024 · 3 comments · May be fixed by #26289

Comments

@serkodev
Copy link

serkodev commented Feb 22, 2024

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: npm@10.2.3
  • 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

Copy link

stackblitz bot commented Feb 22, 2024

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

@manniL
Copy link
Member

manniL commented Feb 22, 2024

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

@abarke
Copy link
Sponsor

abarke commented May 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants