Skip to content

Commit 5ba7bf7

Browse files
committed
Use throwIfNoEntry on Node 14+.
1 parent ede9893 commit 5ba7bf7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ function removeQuerystring(id: string) {
243243

244244
const isFile = (path?: string | undefined): path is string => {
245245
try {
246-
return !!path && fs.statSync(path).isFile()
246+
return (path && fs.statSync(path, { throwIfNoEntry: false })?.isFile()) || false;
247247
} catch {
248+
// Node 12 does not support throwIfNoEntry.
248249
return false
249250
}
250251
}
@@ -331,8 +332,8 @@ function initMappers(options: InternalResolverOptions) {
331332
typeof options.project === 'string'
332333
? [options.project]
333334
: Array.isArray(options.project)
334-
? options.project
335-
: [process.cwd()]
335+
? options.project
336+
: [process.cwd()]
336337

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

0 commit comments

Comments
 (0)