Skip to content

Commit

Permalink
fix: show error if code is not MODULE_NOT_FOUND
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Dec 3, 2021
1 parent 62fd953 commit 82d9432
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ export function tryRequire (id: string, rootDir: string = process.cwd()) {
const _require = jiti(rootDir, { interopDefault: true })
try {
return _require(id)
} catch (_err) {
console.log(_err.code)
// Ignore
} catch (err: any) {
if (err.code !== 'MODULE_NOT_FOUND') {
console.error(`Error trying import ${id} from ${rootDir}`, err)
}
return {}
}
}

0 comments on commit 82d9432

Please sign in to comment.