Skip to content

Commit dfad8f5

Browse files
committed
CR
1 parent 5a15e7a commit dfad8f5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/internal/process/esm_loader.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,23 +58,23 @@ async function initializeLoader() {
5858
const { getOptionValue } = require('internal/options');
5959
const customLoaders = getOptionValue('--experimental-loader');
6060
const preloadModules = getOptionValue('--experimental-import');
61-
const keyedExportsList = await loadInternalModules(customLoaders);
61+
const keyedExportsList = await loadModulesInIsolation(customLoaders);
6262

6363
// Hooks must then be added to external/public loader
6464
// (so they're triggered in userland)
65+
// TODO(@JakobJingleheimer) this should be synchronous
6566
await esmLoader.addCustomLoaders(keyedExportsList);
6667

6768
// Preload after loaders are added so they can be used
6869
if (preloadModules?.length) {
69-
await loadInternalModules(preloadModules);
70+
await loadModulesInIsolation(preloadModules);
7071
}
7172

7273
isESMInitialized = true;
7374
}
7475

75-
async function loadInternalModules(requests) {
76-
if (!ArrayIsArray(requests) || requests.length === 0)
77-
return;
76+
async function loadModulesInIsolation(specifiers) {
77+
if (!ArrayIsArray(specifiers) || specifiers.length === 0) return;
7878

7979
let cwd;
8080
try {
@@ -90,7 +90,7 @@ async function loadInternalModules(requests) {
9090

9191
// Importation must be handled by internal loader to avoid poluting userland
9292
return internalEsmLoader.import(
93-
requests,
93+
specifiers,
9494
pathToFileURL(cwd).href,
9595
ObjectCreate(null),
9696
);

0 commit comments

Comments
 (0)