Skip to content

Commit 1274a25

Browse files
Ayase-252danielleadams
authored andcommitted
doc: align module resolve algorithm with implementation
Fixes: #38128 PR-URL: #38837 Reviewed-By: Guy Bedford <[email protected]>
1 parent 99fb6d4 commit 1274a25

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/api/modules.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,13 @@ LOAD_NODE_MODULES(X, START)
197197
NODE_MODULES_PATHS(START)
198198
1. let PARTS = path split(START)
199199
2. let I = count of PARTS - 1
200-
3. let DIRS = [GLOBAL_FOLDERS]
200+
3. let DIRS = []
201201
4. while I >= 0,
202202
a. if PARTS[I] = "node_modules" CONTINUE
203203
b. DIR = path join(PARTS[0 .. I] + "node_modules")
204-
c. DIRS = DIRS + DIR
204+
c. DIRS = DIR + DIRS
205205
d. let I = I - 1
206-
5. return DIRS
206+
5. return DIRS + GLOBAL_FOLDERS
207207

208208
LOAD_PACKAGE_IMPORTS(X, DIR)
209209
1. Find the closest package scope SCOPE to DIR.

0 commit comments

Comments
 (0)