Skip to content

Commit afeb928

Browse files
chenxinyancJounQin
andauthored
perf: disable throwIfNoEntry on Node 14+ (import-js#182)
Co-authored-by: JounQin <admin@1stg.me>
1 parent ede9893 commit afeb928

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.changeset/cyan-parrots-act.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-import-resolver-typescript": patch
3+
---
4+
5+
perf: disable `throwIfNoEntry` on Node 14+

src/index.ts

+2-1
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())
247247
} catch {
248+
// Node 12 does not support throwIfNoEntry.
248249
return false
249250
}
250251
}

0 commit comments

Comments
 (0)