feat(nuxt3): allow overriding root component using `app.root.vue` (#3733)

This commit is contained in:
pooya parsa 2022-03-17 11:57:02 +01:00 committed by GitHub
parent fb150825ce
commit 91fd16ae52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -63,8 +63,10 @@ export async function resolveApp (nuxt: Nuxt, app: NuxtApp) {
app.mainComponent = tryResolveModule('@nuxt/ui-templates/templates/welcome.vue')
}
// Default root component
app.rootComponent = resolve(nuxt.options.appDir, 'components/nuxt-root.vue')
// Resolve root component
if (!app.rootComponent) {
app.rootComponent = await findPath(['~/app.root', resolve(nuxt.options.appDir, 'components/nuxt-root.vue')])
}
// Resolve error component
if (!app.errorComponent) {