mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 15:42:09 +00:00
feat(nuxt): support for extending error.vue in layers (#9521)
This commit is contained in:
parent
228bc9ce21
commit
5f935aad48
@ -1,5 +1,5 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import { dirname, resolve } from 'pathe'
|
import { dirname, resolve, join } from 'pathe'
|
||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from '@nuxt/schema'
|
import type { Nuxt, NuxtApp, NuxtPlugin, NuxtTemplate, ResolvedNuxtTemplate } from '@nuxt/schema'
|
||||||
import { findPath, resolveFiles, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils, tryResolveModule, resolvePath, resolveAlias } from '@nuxt/kit'
|
import { findPath, resolveFiles, normalizePlugin, normalizeTemplate, compileTemplate, templateUtils, tryResolveModule, resolvePath, resolveAlias } from '@nuxt/kit'
|
||||||
@ -74,7 +74,9 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
|
|||||||
|
|
||||||
// Resolve error component
|
// Resolve error component
|
||||||
if (!app.errorComponent) {
|
if (!app.errorComponent) {
|
||||||
app.errorComponent = (await findPath(['~/error'])) || resolve(nuxt.options.appDir, 'components/nuxt-error-page.vue')
|
app.errorComponent = (await findPath(
|
||||||
|
nuxt.options._layers.map(layer => join(layer.config.srcDir, 'error'))
|
||||||
|
)) ?? resolve(nuxt.options.appDir, 'components/nuxt-error-page.vue')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve layouts/ from all config layers
|
// Resolve layouts/ from all config layers
|
||||||
|
Loading…
Reference in New Issue
Block a user