Skip to content
Prev Previous commit
Next Next commit
Move out main re-resolution
  • Loading branch information
GeoffreyBooth committed Oct 5, 2023
commit 162b6fa219552575ccca45ac4d8fc79beb750009
3 changes: 1 addition & 2 deletions lib/internal/modules/run_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ function shouldUseESMLoader(mainPath) {
function runMainESM(mainPath) {
const { loadESM } = require('internal/process/esm_loader');
const { pathToFileURL } = require('internal/url');
const main = pathToFileURL(mainPath).href;

handleMainPromise(loadESM((esmLoader) => {
const main = path.isAbsolute(mainPath) ?
pathToFileURL(mainPath).href : mainPath;
return esmLoader.import(main, undefined, { __proto__: null });
}));
}
Expand Down