module: fix node_modules search path in edge case · nodejs/node@ccbb463 · GitHub
Skip to content

Commit ccbb463

Browse files
hefangshicjihrig
authored andcommitted
module: fix node_modules search path in edge case
The `p < nmLen` condition will fail when a module's name is end with `node_modules` like `foo_node_modules`. The old logic will miss the `foo_node_modules/node_modules` in node_modules paths. TL;TR, a module named like `foo_node_modules` can't require any module in the node_modules folder. Fixes: #6679 PR-URL: #6670 Reviewed-By: Evan Lucas <evanlucas@me.com>
1 parent 3f46b5c commit ccbb463

2 files changed

Lines changed: 119 additions & 19 deletions

File tree

lib/module.js

Lines changed: 18 additions & 3 deletions
Lines changed: 101 additions & 16 deletions

0 commit comments

Comments
 (0)