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
parent 62b173fc75
commit 661801dc60
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -124,6 +124,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)