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.

Webpack 2's parser does not support the es2017 `async` or `await`

See original GitHub issue

As webpack uses acorn, this depends on https://github.com/ternjs/acorn/issues/441, but it’s possible https://github.com/MatAtBread/acorn-es7-plugin/ can be used to work around it for now.

async did not make it into es7, but as it is now stage-4, it will be in “es8” 😃

If this was available right now, it would allow me to disable the babel-plugin-transform-async-to-generator in my code (replacing with babel-plugin-syntax-async-to-generator for historical reasons) and use the native async/await implementation in Edge 14. Chrome 54 (currently Canary) also already has a native implementation behind the --harmony flag.

An alternative could be to switch to babylon + babel-traverse instead, but that would be a pretty big change; and I’m not sure babylon + babel-types/babel-traverse are API stable yet.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MatAtBreadcommented, Aug 22, 2016

I have a working webpack 2 plugin for this case https://github.com/MatAtBread/webpack-async-await

0reactions
kristianmandrupcommented, Oct 30, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

webpack does not support async/await keyword - Stack Overflow
Usually, we use webpack + babel to transform es6/7 code with this config. test: /\.js[x]?$/, loader: 'babel-loader', query: { presets: ...
Read more >
async - Documentation - GitHub Pages
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use ...
Read more >
How the new 'Top Level Await' feature works in JavaScript
Notes: Top-level await only works at the top level of modules. There is no support for classic scripts or non-async functions. ECMAScript ...
Read more >
ECMAScript Goodies I: Check out the ES2017 Major Features
What are the major features of ES2017 and what's on the list for ES2018? This two-part series explores the latest and greatest features...
Read more >
async function - JavaScript - MDN Web Docs - Mozilla
Note: The await keyword is only valid inside async functions within regular JavaScript code. If you use it outside of an async function's...
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