fix(kit): add better logging for non-resolved modules (#30116)

This commit is contained in:
Daniel Roe 2024-12-02 14:44:24 +00:00 committed by GitHub
parent 9275b2a7be
commit 76abb53bf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -118,6 +118,11 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
}
}
// Throw error if module could not be found
if (typeof nuxtModule === 'string') {
throw new TypeError(`Could not load \`${nuxtModule}\`. Is it installed?`)
}
// Throw error if input is not a function
if (typeof nuxtModule !== 'function') {
throw new TypeError('Nuxt module should be a function: ' + nuxtModule)