GitHub · npm · Edit this page
Syntax only
This plugin only allows Babel to parse this syntax. If you want to transform it then see transform-regenerator, transform-async-to-generator, or transform-async-to-module-method.
Syntax
(async function() {
await loadStory();
console.log("Yey, story successfully loaded!");
}());
npm install --save-dev babel-plugin-syntax-async-functions
.babelrc
(Recommended).babelrc
{
"plugins": ["syntax-async-functions"]
}
babel --plugins syntax-async-functions script.js
require("babel-core").transform("code", {
plugins: ["syntax-async-functions"]
});