Skip to content

Commit bbcb2a2

Browse files
cjihrigrvagg
authored andcommitted
doc: clarify module loading behavior
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 <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 0997178 commit bbcb2a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

doc/api/modules.markdown

+2-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ example, then `require('./some-library')` would attempt to load:
339339
If the module identifier passed to `require()` is not a native module,
340340
and does not begin with `'/'`, `'../'`, or `'./'`, then Node.js starts at the
341341
parent directory of the current module, and adds `/node_modules`, and
342-
attempts to load the module from that location.
342+
attempts to load the module from that location. Node will not append
343+
`node_modules` to a path already ending in `node_modules`.
343344

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

0 commit comments

Comments
 (0)