Skip to content

Commit

Permalink
fix: Fix node 12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbachmann committed May 11, 2019
1 parent f094dde commit c1ff2cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ function loadFile () {
try {
return require(p)
} catch (e) {
const isLoadError = e.code === 'MODULE_NOT_FOUND' && e.message === `Cannot find module '${p}'`
if (!isLoadError) throw e
if (required) throw e
if (!(e.code === 'MODULE_NOT_FOUND' && e.message.startsWith(`Cannot find module '${p}'`))) {
throw e
}
if (opts.required) throw e
}
}

Expand Down

0 comments on commit c1ff2cf

Please sign in to comment.