perf(kit): avoid duplicate join operation (#24717)

This commit is contained in:
Michael Brevard 2023-12-14 13:04:20 +02:00 committed by GitHub
parent a250ca9ef1
commit 1711c33be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,8 +70,9 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
nuxtModule = await importModule(src, nuxt.options.modulesDir).catch(() => null) ?? requireModule(src, { paths: nuxt.options.modulesDir })
// nuxt-module-builder generates a module.json with metadata including the version
if (existsSync(join(dirname(src), 'module.json'))) {
buildTimeModuleMeta = JSON.parse(await fsp.readFile(join(dirname(src), 'module.json'), 'utf-8'))
const moduleMetadataPath = join(dirname(src), 'module.json')
if (existsSync(moduleMetadataPath)) {
buildTimeModuleMeta = JSON.parse(await fsp.readFile(moduleMetadataPath, 'utf-8'))
}
break
} catch (_err: unknown) {