babel-runtime

raw JSON →
6.26.0 verified Sat Apr 25 auth: no javascript deprecated

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.

error Cannot find module 'babel-runtime/core-js/object/keys'
cause Missing dependency or incorrect import path.
fix
Ensure babel-runtime is installed and use correct path: require('babel-runtime/core-js/object/keys')
error TypeError: _classCallCheck is not a function
cause Forgetting to append .default when requiring a helper.
fix
var _classCallCheck = require('babel-runtime/helpers/classCallCheck').default;
error Module not found: Can't resolve 'babel-runtime'
cause babel-runtime not installed or listed in dependencies.
fix
npm install babel-runtime --save (or --save-dev for transform-runtime)
error Duplicate polyfill: core-js/modules/...
cause Both babel-runtime and core-js are imported directly, causing duplication.
fix
Use only babel-runtime's polyfills or remove direct core-js imports.
deprecated babel-runtime v6 is deprecated. Use @babel/runtime v7+ instead.
fix Replace 'babel-runtime' with '@babel/runtime' and update plugins.
breaking In v6, helpers are CommonJS modules; importing them with ES import syntax may fail.
fix Use require() or configure Babel to handle interop.
gotcha The default export is not available; always use named exports or .default property.
fix Access helpers via require('babel-runtime/helpers/xyz').default
deprecated babel-plugin-transform-runtime v6 does not automatically resolve the correct helper vs polyfill; manual configuration needed.
fix Use @babel/plugin-transform-runtime with @babel/runtime.
breaking core-js shims in babel-runtime are for v2 of core-js; mixing with core-js v3 causes conflicts.
fix Use @babel/runtime-corejs2 or @babel/runtime-corejs3 instead.
npm install babel-runtime
yarn add babel-runtime
pnpm add babel-runtime

Shows how to install and use babel-runtime with transform-runtime plugin, requiring helpers and polyfills.

// Install: npm install babel-runtime babel-plugin-transform-runtime
// In .babelrc:
// { "plugins": ["transform-runtime"] }

// After build, helpers like _classCallCheck are automatically required:
var _classCallCheck = require('babel-runtime/helpers/classCallCheck')['default'];

function MyClass() {
  _classCallCheck(this, MyClass);
}

// Use core-js polyfills:
var keys = require('babel-runtime/core-js/object/keys');
var obj = {a: 1, b: 2};
console.log(keys(obj)); // ['a', 'b']