rollup-plugin-async

raw JSON →
1.2.0 verified Mon Apr 27 auth: no javascript deprecated

Rollup plugin that transforms async/await functions into generator functions during bundling using async-to-gen. Current stable version 1.2.0, last released circa 2017. Low release cadence. Differentiator: enables async/await in environments without native support by converting to generators at build time. Alternative to Babel's async-to-generator transform with tighter Rollup integration. Depends on async-to-gen (v1.2.0+). No longer actively maintained; users should consider @rollup/plugin-babel with @babel/plugin-transform-async-to-generator.

error Cannot find module 'rollup-plugin-async'
cause Package not installed or not in node_modules.
fix
Run npm install rollup-plugin-async --save-dev.
error TypeError: async is not a function
cause Importing the default export incorrectly as a named import or calling require without parentheses.
fix
Use const async = require('rollup-plugin-async'); then call async().
error Error: Cannot find module 'async-to-gen'
cause Missing dependency async-to-gen (should be installed automatically but may not be in some setups).
fix
Run npm install async-to-gen or check your package-lock.
deprecated Package is no longer actively maintained. Use @rollup/plugin-babel with @babel/plugin-transform-async-to-generator instead.
fix Replace with @rollup/plugin-babel configuration.
gotcha Async-to-gen may not support all modern async/await syntax variants (e.g., top-level await, for-await-of).
fix Test with your specific async patterns. Consider migrating to Babel if issues arise.
breaking Version 1.2.0 updated async-to-gen to 1.2.0 with proper for-await-of loop support. Older versions may fail on for-await-of.
fix Upgrade to version 1.2.0 or later.
npm install rollup-plugin-async
yarn add rollup-plugin-async
pnpm add rollup-plugin-async

Shows how to use rollup-plugin-async in a Rollup config to transform async functions in input.js.

import { rollup } from 'rollup';
import async from 'rollup-plugin-async';

rollup({
  input: 'input.js',
  plugins: [async()]
}).then(bundle => bundle.write({ file: 'output.js', format: 'iife' }));