fix(kit): fall back to meta version if there's no module.json (#29793)

This commit is contained in:
Aurion SARL 2024-11-05 12:27:06 +01:00 committed by GitHub
parent e6a9b3cc78
commit 7177e81442
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,8 +58,8 @@ export async function getNuxtModuleVersion (module: string | NuxtModule, nuxt: N
} }
// it's possible that the module will be installed, it just hasn't been done yet, preemptively load the instance // it's possible that the module will be installed, it just hasn't been done yet, preemptively load the instance
if (hasNuxtModule(moduleMeta.name)) { if (hasNuxtModule(moduleMeta.name)) {
const { buildTimeModuleMeta } = await loadNuxtModuleInstance(moduleMeta.name, nuxt) const { nuxtModule, buildTimeModuleMeta } = await loadNuxtModuleInstance(moduleMeta.name, nuxt)
return buildTimeModuleMeta.version || false return buildTimeModuleMeta.version || await nuxtModule.getMeta?.().then(r => r.version) || false
} }
return false return false
} }