Babel Core

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

Babel compiler core version 6.26.3. This is an outdated version of Babel (pre-7.x). The current stable releases are v7.29.2 (2026-03-16) and v8.0.0-rc.3 (2026-03-16). babel-core v6 is no longer maintained and should not be used for new projects. Key differentiator vs v7/v8: v6 uses the `babel-core` package while v7+ uses `@babel/core`. It provides core transformation API including `transform`, `transformFile`, `transformFileSync`, and `transformFromAst` methods. Compatible with Node.js and browsers via bundlers. Does not include presets/plugins; those are separate packages.

error Error: Cannot find module 'babel-core'
cause babel-core not installed or moved to @babel/core in v7.
fix
Install babel-core v6: npm install --save-dev babel-core@6.26.3 or migrate to v7: npm install --save-dev @babel/core.
error TypeError: babel.transform is not a function
cause Using default import incorrectly; transform is a named export.
fix
Use import { transform } from 'babel-core' or const transform = require('babel-core').transform.
error Error: Requires Babel "7.0.0-0" but was loaded with "6.26.3"
cause Mixing babel-core v6 with plugins/presets designed for v7.
fix
Ensure all babel packages are of the same major version. For v6, use packages like babel-preset-env; for v7, use @babel/preset-env.
deprecated babel-core v6 is deprecated. Use @babel/core v7+ instead.
fix Install @babel/core: npm install --save-dev @babel/core and update imports to use '@babel/core'.
gotcha babel-core v6 does not include any presets. You must install presets separately (e.g., babel-preset-env) to transpile ES6+ code.
fix Install presets: npm install --save-dev babel-preset-env and add 'presets: ["env"]' to options.
gotcha User-local configuration files (.babelrc) are automatically loaded if babelrc option is not set to false. This may cause unexpected behavior.
fix Set options.babelrc = false to ignore .babelrc files.
breaking In babel-core v6, default options differ from v7 (e.g., 'ast' defaults to true). Be aware when migrating.
fix Review Babel v7 migration guide for option changes.
npm install babel-core
yarn add babel-core
pnpm add babel-core

Transforms ES6 arrow function to ES5 using babel-core transform API with env preset.

import { transform } from 'babel-core';

const code = 'const x = (a, b) => a + b;';
const result = transform(code, {
  presets: ['env'] // requires @babel/preset-env or babel-preset-env
});
console.log(result.code);
// Output: "var x = function x(a, b) { return a + b; };"