Skip to content

Commit

Permalink
doc: clarify module loading behavior
Browse files Browse the repository at this point in the history
The module loading system will not append node_modules to a
path already ending in node_modules. This used to be documented,
but it was lost.

Fixes: #3873
PR-URL: #3920
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
  • Loading branch information
cjihrig authored and jasnell committed Dec 17, 2015
1 parent dbc85a2 commit 4bc71e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion doc/api/modules.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ example, then `require('./some-library')` would attempt to load:
If the module identifier passed to `require()` is not a native module,
and does not begin with `'/'`, `'../'`, or `'./'`, then Node.js starts at the
parent directory of the current module, and adds `/node_modules`, and
attempts to load the module from that location.
attempts to load the module from that location. Node will not append
`node_modules` to a path already ending in `node_modules`.

If it is not found there, then it moves to the parent directory, and so
on, until the root of the file system is reached.
Expand Down

0 comments on commit 4bc71e0

Please sign in to comment.