babel / kneden

Transpile ES2017 async/await to vanilla ES6 Promise chains: a Babel plugin
ISC License
514 stars 41 forks source link

Documentation: "syntax-async-functions" is also required. #115

Closed Dan503 closed 7 years ago

Dan503 commented 7 years ago

Babel doesn't natively support async-await syntax and it produces an error if you try to use async-await syntax in your source files without the syntax-async-functions babel plugin.

So basically instead of having this in your documentation:

.babelrc

{
  "plugins": ["async-to-promises"]
}

It should say this:

.babelrc

{
  "plugins": ["syntax-async-functions", "async-to-promises"]
}

Of course, the change would also be applied it to the "Via CLI", and "Via Node API" code examples as well.

Also, so that people don't have to download both plugins separately, "babel-plugin-syntax-async-functions" should be added to the dependencies list in the package.json file.

loganfsmyth commented 7 years ago

This is not the case.

  1. The parser in its current version does automatically support async functions.
  2. For the older version that had it behind a flag, this plugin already force-enables the flag without the syntax plugin.
Dan503 commented 7 years ago

That's odd then. It wouldn't work for me until "syntax-async-functions" was installed :/

I'm on "~6.4.0" of "babel-core".

loganfsmyth commented 7 years ago

Hmm, I'd expect it to work even on a way old version like that. That is exceptionally old though, so definitely upgrade as a first step.

Dan503 commented 7 years ago

Ok you're right. I just needed to update Babel to the latest version. It doesn't require the "syntax-async-functions" plugin any more :)