Webpack 2's parser does not support the es2017 `async` or `await`
See original GitHub issueAs 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:
- Created 7 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
I have a working webpack 2 plugin for this case https://github.com/MatAtBread/webpack-async-await
Or check here: https://www.npmjs.com/package/babel-preset-es2017