From f034a65a498631b68869ab384800ed1e1c88ad63 Mon Sep 17 00:00:00 2001 From: Karan Mangtani Date: Sat, 7 Feb 2026 14:30:59 +0530 Subject: [PATCH 1/2] esm: update outdated FIXME comment in translators.js --- lib/internal/modules/esm/translators.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 74e90edb5b3a72..9310878de0833d 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -142,8 +142,9 @@ function loadCJSModule(module, source, url, filename, isMain) { specifier = `${pathToFileURL(path)}`; } - // FIXME(node:59666) Currently, the ESM loader re-invents require() here for imported CJS and this - // requires a separate cache to be populated as well as introducing several quirks. This is not ideal. + // NOTE: This re-invented require() is only used on the loader-hook worker thread. + // On the main thread, the authentic require() is used instead (fixed by #60380). + // Remaining quirks on the loader-hook thread: lacks require.cache, require.extensions. const request = { specifier, attributes: importAttributes, phase: kEvaluationPhase, __proto__: null }; const job = cascadedLoader.getOrCreateModuleJob(url, request, kRequireInImportedCJS); job.runSync(); From 67cc5c0a8681ce2aeae5d402394e7afdd32e58fc Mon Sep 17 00:00:00 2001 From: Karan Mangtani Date: Sun, 8 Feb 2026 11:23:57 +0530 Subject: [PATCH 2/2] Update lib/internal/modules/esm/translators.js Co-authored-by: Joyee Cheung --- lib/internal/modules/esm/translators.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 9310878de0833d..59aad5ae79799c 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -144,7 +144,6 @@ function loadCJSModule(module, source, url, filename, isMain) { // NOTE: This re-invented require() is only used on the loader-hook worker thread. // On the main thread, the authentic require() is used instead (fixed by #60380). - // Remaining quirks on the loader-hook thread: lacks require.cache, require.extensions. const request = { specifier, attributes: importAttributes, phase: kEvaluationPhase, __proto__: null }; const job = cascadedLoader.getOrCreateModuleJob(url, request, kRequireInImportedCJS); job.runSync();