es-async

raw JSON →
1.1.0 verified Fri May 01 auth: no javascript

ES2017 async/await transpiler backed by nodent-compiler. Stable v1.1.0, low release cadence. Compiles async functions into ES2016-compatible Promise chains. Differentiates from Babel by targeting strict native Promise behavior with minimal runtime overhead. CLI and programmatic APIs available.

error TypeError: compileAsync is not a function
cause Importing incorrectly using named import instead of default
fix
Use: const compileAsync = require('es-async');
error Cannot find module 'es-async/from-file'
cause Running in environment where subpath exports are not supported
fix
Use direct path: require('es-async/from-file') (Node >=12) or copy file.
gotcha compiled output uses native Promises; ensure runtime supports Promise
fix Polyfill Promise if targeting older environments.
deprecated require('es-async/from-file') returns a function, but future versions may change export shape
fix Check documentation for new submodule exports.
gotcha Code compiled by es-async may be larger than alternatives like Babel due to verbose Promise wrapping
fix Consider minification after compilation.
npm install es-async
yarn add es-async
pnpm add es-async

Compile ES2017 async/await code to ES2016 using default import and String input.

const compileAsync = require('es-async');
const es2017Code = `async function foo() { return await bar; }`;
const es2016Code = compileAsync(es2017Code);
console.log(es2016Code);