Skip to content

Commit

Permalink
Use throwIfNoEntry on Node 14+.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxinyanc committed Sep 7, 2022
1 parent ede9893 commit 5ba7bf7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Expand Up @@ -243,8 +243,9 @@ function removeQuerystring(id: string) {

const isFile = (path?: string | undefined): path is string => {
try {
return !!path && fs.statSync(path).isFile()
return (path && fs.statSync(path, { throwIfNoEntry: false })?.isFile()) || false;
} catch {
// Node 12 does not support throwIfNoEntry.
return false
}
}
Expand Down Expand Up @@ -331,8 +332,8 @@ function initMappers(options: InternalResolverOptions) {
typeof options.project === 'string'
? [options.project]
: Array.isArray(options.project)
? options.project
: [process.cwd()]
? options.project
: [process.cwd()]

const ignore = ['!**/node_modules/**']

Expand Down

0 comments on commit 5ba7bf7

Please sign in to comment.