question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 2 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
3cpcommented, Jul 12, 2021

v4.2.0 is released with this feature.

1reaction
aladdin-addcommented, May 27, 2021

yes!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found