Error trying to use top-level await?
See original GitHub issue> require('meriyah').parseModule('const foo = (await bar)', {next: true})
Uncaught: [ParseError [SyntaxError]: [1:18]: 'Await' may not be used as an identifier in this context] {
index: 18,
line: 1,
column: 18,
description: "[1:18]: 'Await' may not be used as an identifier in this context",
loc: { line: 1, column: 18 }
}
I found https://github.com/meriyah/meriyah/issues/29 but it looks like that issue may have been closed without implementation.
Top-level await is now stage 3, and supported in Node.js v14+.
Issue Analytics
- State:
- Created 2 years ago
- Comments:19 (15 by maintainers)
Top Results From Across the Web
javascript - How can I use async/await at the top level?
when a module using top-level await is evaluated, it returns a promise to the module loader (like an async function does), which waits...
Read more >support for top level await · Issue #253 · evanw/esbuild - GitHub
I am currently working with deno which has top level support, is there any way to use esbuild with top level await?
Read more >ECMAScript: Top-level await | Saeloun Blog
Top -level await enables modules to act as big async functions. With top-level await, ECMAScript Modules (ESM) can await resources. Other modules ...
Read more >Top-level await is available in Node.js modules - Stefan Judis
Node.js' top-level await feature is available in ES modules. Find out about three ways to enable it and untangle your code.
Read more >await - JavaScript - MDN Web Docs
The await operator is used to wait for a Promise and get its fulfillment value. It can only be used inside an async...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
v4.2.0 is released with this feature.
yes!