Skip to content

Commit

Permalink
lib: let deps require node prefixed modules
Browse files Browse the repository at this point in the history
fixup

fixup

PR-URL: #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>
  • Loading branch information
KhafraDev authored and richardlau committed Oct 13, 2023
1 parent eaf9083 commit 1193ca5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/internal/bootstrap/loaders.js
Expand Up @@ -59,6 +59,7 @@ const {
SafeSet,
String,
StringPrototypeStartsWith,
StringPrototypeSlice,
TypeError,
} = primordials;

Expand Down Expand Up @@ -369,7 +370,9 @@ function requireBuiltin(id) {
// Allow internal modules from dependencies to require
// other modules from dependencies by providing fallbacks.
function requireWithFallbackInDeps(request) {
if (!BuiltinModule.map.has(request)) {
if (StringPrototypeStartsWith(request, 'node:')) {
request = StringPrototypeSlice(request, 5);
} else if (!BuiltinModule.map.has(request)) {
request = `internal/deps/${request}`;
}
return requireBuiltin(request);
Expand Down

0 comments on commit 1193ca5

Please sign in to comment.