Skip to content

Commit

Permalink
perf: disable throwIfNoEntry on Node 14+ (#182)
Browse files Browse the repository at this point in the history
Co-authored-by: JounQin <admin@1stg.me>
  • Loading branch information
chenxinyanc and JounQin committed Sep 7, 2022
1 parent ede9893 commit afeb928
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cyan-parrots-act.md
@@ -0,0 +1,5 @@
---
"eslint-import-resolver-typescript": patch
---

perf: disable `throwIfNoEntry` on Node 14+
3 changes: 2 additions & 1 deletion 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())
} catch {
// Node 12 does not support throwIfNoEntry.
return false
}
}
Expand Down

0 comments on commit afeb928

Please sign in to comment.