A Babel plugin that automatically imports regenerator-runtime when generator/async functions are used. Part of the babel-polyfills monorepo, this is the recommended replacement for @babel/plugin-transform-regenerator's built-in helper. Current version 0.6.8, released as part of the @babel/preset-env polyfill strategy. Unlike older approaches, it avoids bundling regenerator-runtime if not needed (tree-shaking friendly) and integrates with the broader babel polyfill ecosystem (corejs, entry/usage transforms). Requires @babel/core >=7.4 or ^8.0.0-0. Deprecated in favor of @babel/plugin-transform-runtime for library authors, but still maintained for use with @babel/preset-env usage-based polyfilling.
npm install babel-plugin-polyfill-regeneratorVerified import paths — ran on the pinned version, not inferred.
Configures Babel with preset-env and the regenerator polyfill plugin to automatically inject regenerator-runtime for async/generator functions.
Remove explicit babel-plugin-polyfill-regenerator and configure @babel/preset-env with useBuiltIns: 'usage' and corejs: 3.
Ensure you are using the latest version (0.6.8) and that your Babel configuration does not have conflicting polyfill plugins.
Configure @babel/preset-env with appropriate useBuiltIns setting, or switch to @babel/plugin-transform-runtime for standalone needs.
Add babel-plugin-polyfill-corejs3 or use @babel/preset-env with corejs setting.
Ensure Babel is configured to output CommonJS (e.g., with @babel/preset-env's modules: 'commonjs' or @babel/plugin-transform-modules-commonjs).
Run npm install babel-plugin-polyfill-regenerator --save-dev
Make sure regenerator-runtime is included in your bundle. If using preset-env with useBuiltIns: 'usage', it should inject the import automatically. If not, add import 'regenerator-runtime/runtime' at the entry point.