@@ -1170,9 +1170,9 @@ function getDefaultLoad(url, filename) {
11701170 * @param {string } id The module ID (without the node: prefix)
11711171 * @param {string } url The module URL (with the node: prefix)
11721172 * @param {string } format Format from resolution.
1173- * @returns {{builtinExports? : any, resultFromHook?: any } } If there are no load hooks or the load hooks do not
1174- * override the format of the builtin, load and return the exports of the builtin module.
1175- * Otherwise, return the loadResult for the caller to continue loading.
1173+ * @returns {{builtinExports: any, resultFromHook: undefined|ModuleLoadResult } } If there are no load
1174+ * hooks or the load hooks do not override the format of the builtin, load and return the exports
1175+ * of the builtin module. Otherwise, return the loadResult for the caller to continue loading.
11761176 */
11771177function loadBuiltinWithHooks ( id , url , format ) {
11781178 let resultFromHook ;
@@ -1184,14 +1184,15 @@ function loadBuiltinWithHooks(id, url, format) {
11841184 getCjsConditionsArray ( ) , getDefaultLoad ( url , id ) , validateLoadStrict ) ;
11851185 if ( resultFromHook . format && resultFromHook . format !== 'builtin' ) {
11861186 debug ( 'loadBuiltinWithHooks overriding module' , id , url , resultFromHook ) ;
1187- return { resultFromHook } ; // Format has been overridden, return result for the caller to continue loading.
1187+ // Format has been overridden, return result for the caller to continue loading.
1188+ return { builtinExports : undefined , resultFromHook } ;
11881189 }
11891190 }
11901191
11911192 // No hooks or the hooks have not overridden the format. Load it as a builtin module and return the
11921193 // exports.
11931194 const mod = loadBuiltinModule ( id ) ;
1194- return { builtinExports : mod . exports } ;
1195+ return { builtinExports : mod . exports , resultFromHook : undefined } ;
11951196}
11961197
11971198/**
0 commit comments