Skip to content

Commit a49f57b

Browse files
committed
module: fix schema only core module on convertCJSFilenameToURL
1 parent 68bac3d commit a49f57b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/internal/modules/customization_hooks.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ function convertCJSFilenameToURL(filename) {
130130
if (builtinId) {
131131
return `node:${builtinId}`;
132132
}
133+
if (BuiltinModule.canBeRequiredByUsers(filename) && !filename.startsWith('node:')) {
134+
return `node:${filename}`;
135+
}
133136
// Handle the case where filename is neither a path, nor a built-in id,
134137
// which is possible via monkey-patching.
135138
if (isAbsolute(filename)) {
@@ -269,7 +272,7 @@ function validateLoad(url, context, result) {
269272
// To align with module.register(), the load hooks are still invoked for
270273
// the builtins even though the default load step only provides null as source,
271274
// and any source content for builtins provided by the user hooks are ignored.
272-
if (!StringPrototypeStartsWith(url, 'node:') &&
275+
if (!BuiltinModule.isBuiltin(url) &&
273276
typeof result.source !== 'string' &&
274277
!isAnyArrayBuffer(source) &&
275278
!isArrayBufferView(source)) {

0 commit comments

Comments
 (0)