From 3782ac0a2c15e7b619257e9260717617a1ad37d8 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 9 Mar 2024 06:30:02 +0000 Subject: [PATCH] fix(kit): handle errors resolving module path --- packages/kit/src/module/install.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kit/src/module/install.ts b/packages/kit/src/module/install.ts index 47bf32937a..fc3d97bd66 100644 --- a/packages/kit/src/module/install.ts +++ b/packages/kit/src/module/install.ts @@ -74,9 +74,9 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n const paths = [join(nuxtModule, 'nuxt'), join(nuxtModule, 'module'), nuxtModule] let error: unknown for (const path of paths) { - const src = await resolvePath(path) - // Prefer ESM resolution if possible try { + const src = await resolvePath(path) + // Prefer ESM resolution if possible 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