{"id":22306,"library":"rollup-regenerator-runtime","title":"rollup-regenerator-runtime","description":"Provides the regenerator runtime as a self-contained module for bundling with Rollup. Version 6.23.1 is the latest stable release. It replaces the default babel-runtime regenerator import with a local copy, avoiding external dependencies when using async/await and generators in libraries compiled with Rollup. Key differentiator: allows bundling regenerator runtime without requiring the full babel-runtime package, reducing bundle size and avoiding issues with Rollup's module resolution.","status":"active","version":"6.23.1","language":"javascript","source_language":"en","source_url":"https://github.com/ForbesLindesay/rollup-regenerator-runtime","tags":["javascript"],"install":[{"cmd":"npm install rollup-regenerator-runtime","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-regenerator-runtime","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-regenerator-runtime","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to configure the runtime plugin to use this module instead of babel-runtime","package":"babel-plugin-transform-runtime","optional":false},{"reason":"Transforms async/await and generator functions into code that uses the regenerator runtime","package":"babel-plugin-transform-regenerator","optional":false}],"imports":[{"note":"This module registers regeneratorRuntime globally as a side effect; no named or default export is provided.","wrong":"import regeneratorRuntime from 'rollup-regenerator-runtime';","symbol":"regeneratorRuntime","correct":"import 'rollup-regenerator-runtime';"},{"note":"CommonJS require will return an empty object; use import for side effects.","wrong":"const regeneratorRuntime = require('rollup-regenerator-runtime');","symbol":"default import","correct":"import 'rollup-regenerator-runtime';"},{"note":"The module has no exports; use bare require() for side effects only.","wrong":"const regen = require('rollup-regenerator-runtime');","symbol":"CommonJS require","correct":"require('rollup-regenerator-runtime');"}],"quickstart":{"code":"// .babelrc\n{\n  \"plugins\": [\n    \"transform-regenerator\",\n    [\"transform-runtime\", {\n      \"helpers\": false,\n      \"polyfill\": false,\n      \"regenerator\": true,\n      \"moduleName\": \"rollup-regenerator-runtime\"\n    }]\n  ]\n}\n\n// In your entry file (must be imported before any async/await or generators)\nimport 'rollup-regenerator-runtime';","lang":"javascript","description":"Shows Babel configuration to replace babel-runtime regenerator with rollup-regenerator-runtime, and the import needed in the entry file."},"warnings":[{"fix":"Use `import 'rollup-regenerator-runtime';` or `require('rollup-regenerator-runtime');` without assigning to a variable.","message":"The module must be imported (or required) as a side effect; it does not export anything. CommonJS require returns an empty object.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure Babel configuration includes the plugins as shown in quickstart.","message":"This package only works when used as the regenerator moduleName in babel-plugin-transform-runtime. It does not function standalone.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Set `moduleName` to 'rollup-regenerator-runtime' in transform-runtime options and import 'rollup-regenerator-runtime' in your entry file.","cause":"Babel transforms async/await but still imports from default 'regenerator-runtime' instead of 'rollup-regenerator-runtime'.","error":"Module not found: Can't resolve 'regenerator-runtime' in ..."},{"fix":"Ensure `import 'rollup-regenerator-runtime';` is placed at the top of your entry file, before any async functions.","cause":"The global regeneratorRuntime may not have been registered before async/await code runs.","error":"regeneratorRuntime is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}