fix(nuxt): handle unset spa-loading fallback (#23120)

This commit is contained in:
Daniel Roe 2023-09-11 13:07:28 +01:00 committed by GitHub
parent 28af761c74
commit df6a992cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -420,6 +420,9 @@ function spaLoadingTemplate (nuxt: Nuxt) {
return defaultSpaLoadingTemplate({})
}
console.warn(`[nuxt] Could not load custom \`spaLoadingTemplate\` path as it does not exist: \`${nuxt.options.spaLoadingTemplate}\`.`)
if (nuxt.options.spaLoadingTemplate) {
console.warn(`[nuxt] Could not load custom \`spaLoadingTemplate\` path as it does not exist: \`${nuxt.options.spaLoadingTemplate}\`.`)
}
return ''
}

View File

@ -243,7 +243,7 @@ export default defineUntypedSchema({
* @type {string | boolean}
*/
spaLoadingTemplate: {
$resolve: async (val, get) => typeof val === 'string' ? resolve(await get('srcDir'), val) : val
$resolve: async (val, get) => typeof val === 'string' ? resolve(await get('srcDir'), val) : val ?? null
},
/**