Skip to content

Commit

Permalink
fix(kit): handle errors resolving module path
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Mar 9, 2024
1 parent 63bfaac commit 3782ac0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/kit/src/module/install.ts
Expand Up @@ -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
Expand Down

0 comments on commit 3782ac0

Please sign in to comment.