google / google/closure-compiler
Support top-level await
Open
triage-done
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
As of Safari 15, all major browsers will support top-level await. However it looks like Closure Compiler doesn't support this. (It also appears to be missing a specific flag to indicate module input or output, perhaps that is related.)
Tested with v20210601, in.js: `await null;`
Command line: `java -jar ./compiler.jar --js in.js --js_output_file out.js`
Observed result:
```
in.js:1:0: ERROR - [JSC_PARSE_ERROR] Parse error. 'await' used in a non-async function context
1| await null;
^
1 error(s), 0 warning(s)
```
Expected result: allow usage of top-level await.
Contributor guide
Assessment
This issue has not been assessed yet.