Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix(kit): log module id to the console when import fails (#8198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Araneline committed Oct 15, 2022
1 parent 5e7dfc2 commit ddbfae1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/kit/src/module/install.ts
Expand Up @@ -42,7 +42,13 @@ async function normalizeModule (nuxtModule: string | NuxtModule, inlineOptions?:
const _src = resolveModule(resolveAlias(nuxtModule), { paths: nuxt.options.modulesDir })
// TODO: also check with type: 'module' in closest `package.json`
const isESM = _src.endsWith('.mjs')
nuxtModule = isESM ? await importModule(_src) : requireModule(_src)

try {
nuxtModule = isESM ? await importModule(_src) : requireModule(_src)
} catch (error: unknown) {
console.error(`Error while requiring module \`${nuxtModule}\`: ${error}`)
throw error
}
}

// Throw error if input is not a function
Expand Down

0 comments on commit ddbfae1

Please sign in to comment.