{"id":26789,"library":"babel-runtime","title":"babel-runtime","description":"babel-runtime is a self-contained runtime helper library for Babel-transpiled code, version 6.26.0. It provides polyfills and helpers (e.g., `classCallCheck`, `extends`, `typeof`) for ES6+ features without polluting the global scope. Unlike `@babel/runtime` (v7+), this is the legacy v6 package. It is stable but no longer actively developed; users should migrate to `@babel/runtime` v7+ for new projects. Key differentiator: bundling helpers at build time via `babel-plugin-transform-runtime` to avoid code duplication.","status":"deprecated","version":"6.26.0","language":"javascript","source_language":"en","source_url":"https://github.com/babel/babel/tree/master/packages/babel-runtime","tags":["javascript"],"install":[{"cmd":"npm install babel-runtime","lang":"bash","label":"npm"},{"cmd":"yarn add babel-runtime","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-runtime","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides polyfills for built-ins like Promise, Symbol, etc.","package":"core-js","optional":false},{"reason":"Provides async/await runtime support.","package":"regenerator-runtime","optional":false}],"imports":[{"note":"No default export; this module is used indirectly via Babel plugins.","wrong":"import babelRuntime from 'babel-runtime'","symbol":"default","correct":"require('babel-runtime')"},{"note":"Helpers are CommonJS modules; require the .default property or use Babel's transform-runtime plugin.","wrong":"import interopRequireDefault from 'babel-runtime/helpers/interopRequireDefault'","symbol":"helpers","correct":"var _interopRequireDefault = require('babel-runtime/helpers/interopRequireDefault').default;"},{"note":"Core-js shims are CommonJS modules and should be required, not imported, unless configured.","wrong":"import 'babel-runtime/core-js/object/keys'","symbol":"core-js/shims","correct":"require('babel-runtime/core-js/object/keys');"}],"quickstart":{"code":"// Install: npm install babel-runtime babel-plugin-transform-runtime\n// In .babelrc:\n// { \"plugins\": [\"transform-runtime\"] }\n\n// After build, helpers like _classCallCheck are automatically required:\nvar _classCallCheck = require('babel-runtime/helpers/classCallCheck')['default'];\n\nfunction MyClass() {\n  _classCallCheck(this, MyClass);\n}\n\n// Use core-js polyfills:\nvar keys = require('babel-runtime/core-js/object/keys');\nvar obj = {a: 1, b: 2};\nconsole.log(keys(obj)); // ['a', 'b']","lang":"javascript","description":"Shows how to install and use babel-runtime with transform-runtime plugin, requiring helpers and polyfills."},"warnings":[{"fix":"Replace 'babel-runtime' with '@babel/runtime' and update plugins.","message":"babel-runtime v6 is deprecated. Use @babel/runtime v7+ instead.","severity":"deprecated","affected_versions":"6.x"},{"fix":"Use require() or configure Babel to handle interop.","message":"In v6, helpers are CommonJS modules; importing them with ES import syntax may fail.","severity":"breaking","affected_versions":"6.x"},{"fix":"Access helpers via require('babel-runtime/helpers/xyz').default","message":"The default export is not available; always use named exports or .default property.","severity":"gotcha","affected_versions":"6.x"},{"fix":"Use @babel/plugin-transform-runtime with @babel/runtime.","message":"babel-plugin-transform-runtime v6 does not automatically resolve the correct helper vs polyfill; manual configuration needed.","severity":"deprecated","affected_versions":"6.x"},{"fix":"Use @babel/runtime-corejs2 or @babel/runtime-corejs3 instead.","message":"core-js shims in babel-runtime are for v2 of core-js; mixing with core-js v3 causes conflicts.","severity":"breaking","affected_versions":"6.x"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Ensure babel-runtime is installed and use correct path: require('babel-runtime/core-js/object/keys')","cause":"Missing dependency or incorrect import path.","error":"Cannot find module 'babel-runtime/core-js/object/keys'"},{"fix":"var _classCallCheck = require('babel-runtime/helpers/classCallCheck').default;","cause":"Forgetting to append .default when requiring a helper.","error":"TypeError: _classCallCheck is not a function"},{"fix":"npm install babel-runtime --save (or --save-dev for transform-runtime)","cause":"babel-runtime not installed or listed in dependencies.","error":"Module not found: Can't resolve 'babel-runtime'"},{"fix":"Use only babel-runtime's polyfills or remove direct core-js imports.","cause":"Both babel-runtime and core-js are imported directly, causing duplication.","error":"Duplicate polyfill: core-js/modules/..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}