chore: handle app.vue fallback

This commit is contained in:
Sébastien Chopin 2020-08-19 17:28:04 +02:00
parent 5b2f0fa191
commit ca8d465073

View File

@ -30,8 +30,7 @@ export async function createApp (builder: Builder, options: Partial<NuxtApp> = {
// Resolve app.main
if (!app.main) {
app.main = nuxt.resolver.tryResolvePath('~/App') ||
nuxt.resolver.tryResolvePath('~/app') ||
resolve(nuxt.options.appDir, 'app.vue')
nuxt.resolver.tryResolvePath('~/app')
}
// Resolve pages/
@ -39,5 +38,12 @@ export async function createApp (builder: Builder, options: Partial<NuxtApp> = {
app.routes.push(...await resolvePagesRoutes(builder, app))
}
// Fallback app.main
if (!app.main && app.routes.length) {
app.main = resolve(nuxt.options.appDir, 'app.pages.vue')
} else if (!app.main) {
app.main = resolve(nuxt.options.appDir, 'app.tutorial.vue')
}
return app
}