Skip to content

Commit 486bd1b

Browse files
bmeckMylesBorins
authored andcommitted
doc: require uses fs root for '/' prefix
PR-URL: #11897 Fixes: #7151 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 3e4ecca commit 486bd1b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/api/modules.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,13 @@ require(X) from module at path Y
149149
1. If X is a core module,
150150
a. return the core module
151151
b. STOP
152-
2. If X begins with './' or '/' or '../'
152+
2. If X begins with '/'
153+
a. set Y to be the filesystem root
154+
3. If X begins with './' or '/' or '../'
153155
a. LOAD_AS_FILE(Y + X)
154156
b. LOAD_AS_DIRECTORY(Y + X)
155-
3. LOAD_NODE_MODULES(X, dirname(Y))
156-
4. THROW "not found"
157+
4. LOAD_NODE_MODULES(X, dirname(Y))
158+
5. THROW "not found"
157159
158160
LOAD_AS_FILE(X)
159161
1. If X is a file, load X as JavaScript text. STOP

0 commit comments

Comments
 (0)