Skip to content

Commit 01b4b6d

Browse files
mertmert
mert
authored and
mert
committed
Refine error handling for top-level await in CommonJS modules
1 parent bb74388 commit 01b4b6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_contextify.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -1826,7 +1826,8 @@ bool ShouldRetryAsESM(Realm* realm,
18261826
"To use top-level await, add \"type\": \"module\" to your "
18271827
"package.json "
18281828
"or rename the file to use the .mjs extension. Alternatively, wrap "
1829-
"the await expression in an async function.";
1829+
"the await expression in an async function. Module syntax like "
1830+
"import/export statements requires proper module configuration.";
18301831

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

0 commit comments

Comments
 (0)