Skip to content

Commit a63eb46

Browse files
committed
fix: fix prefix-only modules not marked as builtin
Following @ljharb's feedback in #295 (comment), a different version of isBuiltin function has been implemented.
1 parent a4c6c78 commit a63eb46

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: .changeset/red-giraffes-sleep.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'eslint-import-resolver-typescript': patch
3+
---
4+
5+
fix: fix prefix-only Node.js modules not correctly recognized as builtin, a regression in v3.6.2

Diff for: src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const digestHashObject = (value: object | null | undefined) =>
125125
* versions of Node.js, we can use module.isBuiltin instead of this function.
126126
*/
127127
function isBuiltin(moduleName: string) {
128-
return builtinModules.includes(moduleName.replace(/^node:/, ''))
128+
return moduleName.startsWith('node:') || builtinModules.includes(moduleName)
129129
}
130130

131131
/**

0 commit comments

Comments
 (0)