module: improve resolve paths validation · nodejs/node@119a590 · GitHub
Skip to content

Commit 119a590

Browse files
cjihrigtargos
authored andcommitted
module: improve resolve paths validation
This commit adds input validation to require.resolve()'s paths option. Prior to this change, passing in a non-array value lead to a misleading 'module not found' error. Refs: #27583 PR-URL: #27613 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6624f80 commit 119a590

2 files changed

Lines changed: 30 additions & 16 deletions

File tree

lib/internal/modules/cjs/loader.js

Lines changed: 22 additions & 16 deletions

test/fixtures/require-resolve.js

Lines changed: 8 additions & 0 deletions

0 commit comments

Comments
 (0)