{"id":20505,"library":"regenerator-preset","title":"regenerator-preset","description":"Babel preset for easily using regenerator-transform to compile generator and async functions to ES5-compatible code. Current version 0.14.1. Release cadence is slow, primarily updated alongside the broader regenerator project. Key differentiator: provides a simple Babel preset wrapper around regenerator-transform, simplifying configuration compared to manually enabling the transform plugin. Alternatives include using @babel/plugin-transform-regenerator directly.","status":"active","version":"0.14.1","language":"javascript","source_language":"en","source_url":"https://github.com/facebook/regenerator#main","tags":["javascript","regenerator","runtime","generator","async"],"install":[{"cmd":"npm install regenerator-preset","lang":"bash","label":"npm"},{"cmd":"yarn add regenerator-preset","lang":"bash","label":"yarn"},{"cmd":"pnpm add regenerator-preset","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Babel core required to use presets","package":"@babel/core","optional":false}],"imports":[{"note":"This is a CJS package. Use require for Node environments.","wrong":"import regeneratorPreset from 'regenerator-preset';","symbol":"default","correct":"module.exports = require('regenerator-preset');"},{"note":"String reference works with Babel config files; require is for programmatic use.","wrong":"{\"presets\": [require('regenerator-preset')]}","symbol":"Babel config","correct":"{\"presets\": [\"regenerator-preset\"]}"},{"note":"There are no official TypeScript types for this package.","wrong":"import regeneratorPreset from 'regenerator-preset';","symbol":"TypeScript types","correct":"No bundled types; use @types/babel__preset-env or similar"}],"quickstart":{"code":"// Install: npm install --save-dev regenerator-preset\n// In .babelrc or babel.config.js:\n{\n  \"presets\": [\"regenerator-preset\"]\n}\n// This enables regenerator-transform to compile generator and async functions.\n// Example input:\n// async function foo() {\n//   await bar();\n// }\n// Example output (simplified) uses regeneratorRuntime.","lang":"javascript","description":"Shows how to configure Babel to use regenerator-preset for transforming async/generator functions."},"warnings":[{"fix":"Add regenerator-runtime as a dependency and import it in your entry file.","message":"regenerator-preset does not include regenerator-runtime; you must add it separately to ensure proper runtime support.","severity":"gotcha","affected_versions":"all"},{"fix":"Use @babel/preset-env with \"useBuiltIns\": \"usage\" to automatically include regenerator-runtime.","message":"The package is deprecated in favor of using @babel/preset-env which includes regenerator-transform automatically.","severity":"deprecated","affected_versions":">=0.14.0"},{"fix":"Explicitly set options in your Babel config if needed: ['regenerator-preset', { 'asyncGenerators': true }].","message":"If using with async functions, ensure 'async' option is enabled in regenerator-transform; it is enabled by default, but may conflict with other plugins.","severity":"gotcha","affected_versions":">=0.7.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install regenerator-runtime and import it: npm install regenerator-runtime; then add import 'regenerator-runtime/runtime';","cause":"Missing regenerator-runtime in the runtime environment.","error":"ReferenceError: regeneratorRuntime is not defined"},{"fix":"Ensure regenerator-preset is in your Babel presets array and that Babel is configured to run on the file.","cause":"Babel not transpiling async/generator functions because preset is not correctly applied.","error":"SyntaxError: Unexpected token function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}