Q:

Unexpected token while using async await with babel

Get unexpected token when using async/await with babel 6
boot.js
require("babel-core/register")({
  ignore: "./node_modules"
});
require("babel-polyfill");

asyncAwaitSample.js
async function() {
    await someAsyncAction();
  }()

.babelrc
{
  "presets": ["es2015", "stage-0", "react"]
}

And compiler is shooting error on string async function() {, it says " Unexpected token '{' " 

A:

did you install babel-plugin-transform-async-to-generator?
npm install babel-plugin-transform-async-to-generator
and in your .babelrc
{
  "plugins": ["transform-async-to-generator"]
}

source https://babeljs.io/docs/plugins/transform-async-to-generator/
and then do:
(async function() {
  await someAsyncAction();
})()

