mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
fix(nuxt): do not warn about missing layouts on error page (#25008)
This commit is contained in:
parent
7087a06c6d
commit
ea02e29b9e
@ -1,5 +1,6 @@
|
||||
import { defineNuxtPlugin } from '../nuxt'
|
||||
import { onNuxtReady } from '../composables/ready'
|
||||
import { useError } from '../composables/error'
|
||||
|
||||
// @ts-expect-error virtual file
|
||||
import layouts from '#build/layouts'
|
||||
@ -7,8 +8,10 @@ import layouts from '#build/layouts'
|
||||
export default defineNuxtPlugin({
|
||||
name: 'nuxt:checkIfLayoutUsed',
|
||||
setup (nuxtApp) {
|
||||
const error = useError()
|
||||
|
||||
function checkIfLayoutUsed () {
|
||||
if (!nuxtApp._isNuxtLayoutUsed && Object.keys(layouts).length > 0) {
|
||||
if (!error.value && !nuxtApp._isNuxtLayoutUsed && Object.keys(layouts).length > 0) {
|
||||
console.warn('[nuxt] Your project has layouts but the `<NuxtLayout />` component has not been used.')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user