Registry / serialization / regenerator-preset

regenerator-preset

JSON →
library0.14.1jsnpmunverified

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.

npm install regenerator-preset
INSTALL
IMPORT
SIG · REGENERATOR-PRESET
R
regenerator-preset
serializationjavascriptv0.14.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
module.exports = require('regenerator-preset');
import regeneratorPreset from 'regenerator-preset';
This is a CJS package. Use require for Node environments.
Babel config
{"presets": ["regenerator-preset"]}
{"presets": [require('regenerator-preset')]}
String reference works with Babel config files; require is for programmatic use.
TypeScript types
No bundled types; use @types/babel__preset-env or similar
import regeneratorPreset from 'regenerator-preset';
There are no official TypeScript types for this package.

Shows how to configure Babel to use regenerator-preset for transforming async/generator functions.

// Install: npm install --save-dev regenerator-preset // In .babelrc or babel.config.js: { "presets": ["regenerator-preset"] } // This enables regenerator-transform to compile generator and async functions. // Example input: // async function foo() { // await bar(); // } // Example output (simplified) uses regeneratorRuntime.
Debug
Known issues
gotcharegenerator-preset does not include regenerator-runtime; you must add it separately to ensure proper runtime support.
fix
Add regenerator-runtime as a dependency and import it in your entry file.
affects: all
deprecatedThe package is deprecated in favor of using @babel/preset-env which includes regenerator-transform automatically.
fix
Use @babel/preset-env with "useBuiltIns": "usage" to automatically include regenerator-runtime.
affects: >=0.14.0
gotchaIf using with async functions, ensure 'async' option is enabled in regenerator-transform; it is enabled by default, but may conflict with other plugins.
fix
Explicitly set options in your Babel config if needed: ['regenerator-preset', { 'asyncGenerators': true }].
affects: >=0.7.0
Errors
Common errors & fixes
ReferenceError: regeneratorRuntime is not defined
Missing regenerator-runtime in the runtime environment.
fix
Install regenerator-runtime and import it: npm install regenerator-runtime; then add import 'regenerator-runtime/runtime';
SyntaxError: Unexpected token function
Babel not transpiling async/generator functions because preset is not correctly applied.
fix
Ensure regenerator-preset is in your Babel presets array and that Babel is configured to run on the file.
Upgrade
Version history
0.14.1latest on npm
Audit
Dependencies
@babel/corerequiredBabel core required to use presets
Agent activity
9 hits · last 30 days
node
8
Resources
regenerator-preset — npm install regenerator-preset · libregistry