Skip to content

Commit a873a22

Browse files
mertmertcanaltin
mert
authored andcommitted
Refine error handling for top-level await in CommonJS modules
1 parent 141140e commit a873a22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_contextify.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,8 @@ bool ShouldRetryAsESM(Realm* realm,
18521852
"To use top-level await, add \"type\": \"module\" to your "
18531853
"package.json "
18541854
"or rename the file to use the .mjs extension. Alternatively, wrap "
1855-
"the await expression in an async function.";
1855+
"the await expression in an async function. Module syntax like "
1856+
"import/export statements requires proper module configuration.";
18561857

18571858
isolate->ThrowException(v8::Exception::SyntaxError(
18581859
String::NewFromUtf8(isolate, error_text).ToLocalChecked()));

0 commit comments

Comments
 (0)