Registry / babel-runtime

babel-runtime

JSON →
library6.26.0jsnpmunverified

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.

npm install babel-runtime
INSTALL
IMPORT
SIG · BABEL-RUNTIME
B
babel-runtime
javascriptv6.26.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
require('babel-runtime')
import babelRuntime from 'babel-runtime'
No default export; this module is used indirectly via Babel plugins.
helpers
var _interopRequireDefault = require('babel-runtime/helpers/interopRequireDefault').default;
import interopRequireDefault from 'babel-runtime/helpers/interopRequireDefault'
Helpers are CommonJS modules; require the .default property or use Babel's transform-runtime plugin.
core-js/shims
require('babel-runtime/core-js/object/keys');
import 'babel-runtime/core-js/object/keys'
Core-js shims are CommonJS modules and should be required, not imported, unless configured.

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']
Debug
Known issues
deprecatedbabel-runtime v6 is deprecated. Use @babel/runtime v7+ instead.
fix
Replace 'babel-runtime' with '@babel/runtime' and update plugins.
affects: 6.x
breakingIn v6, helpers are CommonJS modules; importing them with ES import syntax may fail.
fix
Use require() or configure Babel to handle interop.
affects: 6.x
gotchaThe default export is not available; always use named exports or .default property.
fix
Access helpers via require('babel-runtime/helpers/xyz').default
affects: 6.x
deprecatedbabel-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.
affects: 6.x
breakingcore-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.
affects: 6.x
Errors
Common errors & fixes
Cannot find module 'babel-runtime/core-js/object/keys'
Missing dependency or incorrect import path.
fix
Ensure babel-runtime is installed and use correct path: require('babel-runtime/core-js/object/keys')
TypeError: _classCallCheck is not a function
Forgetting to append .default when requiring a helper.
fix
var _classCallCheck = require('babel-runtime/helpers/classCallCheck').default;
Module not found: Can't resolve 'babel-runtime'
babel-runtime not installed or listed in dependencies.
fix
npm install babel-runtime --save (or --save-dev for transform-runtime)
Duplicate polyfill: core-js/modules/...
Both babel-runtime and core-js are imported directly, causing duplication.
fix
Use only babel-runtime's polyfills or remove direct core-js imports.
Upgrade
Version history
6.26.0latest on npm
Audit
Dependencies
core-jsrequiredProvides polyfills for built-ins like Promise, Symbol, etc.
regenerator-runtimerequiredProvides async/await runtime support.
Agent activity
2 hits · last 30 days
node
2
Resources
babel-runtime — npm install babel-runtime · libregistry