diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js index 1ffbdb485db28c5..fd592f45ffd3e9d 100644 --- a/lib/internal/modules/run_main.js +++ b/lib/internal/modules/run_main.js @@ -178,7 +178,7 @@ function executeUserEntryPoint(main = process.argv[1]) { const { shouldRetryAsESM } = internalBinding('contextify'); const mainPath = resolvedMain || main; mainURL = pathToFileURL(mainPath).href; - retryAsESM = shouldRetryAsESM(error.message, cjsLoader.entryPointSource, mainPath); + retryAsESM = shouldRetryAsESM(error.message, cjsLoader.entryPointSource, mainURL); // In case the entry point is a large file, such as a bundle, // ensure no further references can prevent it being garbage-collected. cjsLoader.entryPointSource = undefined; diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 9e44fc3c74f6dbc..67809ea6c47694c 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -1583,7 +1583,7 @@ static void ContainsModuleSyntax(const FunctionCallbackInfo& args) { CHECK(args[1]->IsString()); Local filename = args[1].As(); - // Argument 2: resource name (URL for module). + // Argument 2: resource name (URL for ES module). Local resource_name = filename; if (args[2]->IsString()) { resource_name = args[2].As();