Skip to content

Commit 1193ca5

Browse files
KhafraDevrichardlau
authored andcommittedOct 13, 2023
lib: let deps require node prefixed modules
fixup fixup PR-URL: nodejs#50047 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
1 parent eaf9083 commit 1193ca5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎lib/internal/bootstrap/loaders.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const {
5959
SafeSet,
6060
String,
6161
StringPrototypeStartsWith,
62+
StringPrototypeSlice,
6263
TypeError,
6364
} = primordials;
6465

@@ -369,7 +370,9 @@ function requireBuiltin(id) {
369370
// Allow internal modules from dependencies to require
370371
// other modules from dependencies by providing fallbacks.
371372
function requireWithFallbackInDeps(request) {
372-
if (!BuiltinModule.map.has(request)) {
373+
if (StringPrototypeStartsWith(request, 'node:')) {
374+
request = StringPrototypeSlice(request, 5);
375+
} else if (!BuiltinModule.map.has(request)) {
373376
request = `internal/deps/${request}`;
374377
}
375378
return requireBuiltin(request);

0 commit comments

Comments
 (0)