mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(kit): handle errors resolving module path
This commit is contained in:
parent
63bfaac120
commit
3782ac0a2c
@ -74,9 +74,9 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
|
|||||||
const paths = [join(nuxtModule, 'nuxt'), join(nuxtModule, 'module'), nuxtModule]
|
const paths = [join(nuxtModule, 'nuxt'), join(nuxtModule, 'module'), nuxtModule]
|
||||||
let error: unknown
|
let error: unknown
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
const src = await resolvePath(path)
|
|
||||||
// Prefer ESM resolution if possible
|
|
||||||
try {
|
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 })
|
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
|
// nuxt-module-builder generates a module.json with metadata including the version
|
||||||
|
Loading…
Reference in New Issue
Block a user