Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bbcb2a2

Browse filesBrowse 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 <jasnell@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
1 parent 0997178 commit bbcb2a2
Copy full SHA for bbcb2a2

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎doc/api/modules.markdown‎

Copy file name to clipboardExpand all lines: doc/api/modules.markdown
+2-1Lines changed: 2 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.