Skip to content

Commit 6eec04e

Browse files
committed
fixup! module: detect ESM syntax by trying to recompile as SourceTextModule
1 parent dc9f175 commit 6eec04e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/internal/modules/run_main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function executeUserEntryPoint(main = process.argv[1]) {
178178
const { shouldRetryAsESM } = internalBinding('contextify');
179179
const mainPath = resolvedMain || main;
180180
mainURL = pathToFileURL(mainPath).href;
181-
retryAsESM = shouldRetryAsESM(error.message, cjsLoader.entryPointSource, mainPath);
181+
retryAsESM = shouldRetryAsESM(error.message, cjsLoader.entryPointSource, mainURL);
182182
// In case the entry point is a large file, such as a bundle,
183183
// ensure no further references can prevent it being garbage-collected.
184184
cjsLoader.entryPointSource = undefined;

src/node_contextify.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ static void ContainsModuleSyntax(const FunctionCallbackInfo<Value>& args) {
15831583
CHECK(args[1]->IsString());
15841584
Local<String> filename = args[1].As<String>();
15851585

1586-
// Argument 2: resource name (URL for module).
1586+
// Argument 2: resource name (URL for ES module).
15871587
Local<String> resource_name = filename;
15881588
if (args[2]->IsString()) {
15891589
resource_name = args[2].As<String>();

0 commit comments

Comments
 (0)