🔧
Build Tool30M+/wkMIT

@babel/core

Babel is the standard JavaScript compiler that transforms modern JavaScript and TypeScript syntax into backward-compatible versions that run in older browsers a

Installation

npm
npm install -D @babel/core @babel/preset-env
yarn
yarn add -D @babel/core @babel/preset-env
pnpm
pnpm add -D @babel/core @babel/preset-env

Import

ESM
import * as babel from '@babel/core';

Quick Example

usage
// babel.config.json
{
  "presets": [
    ["@babel/preset-env", { "targets": "> 0.5%, not dead" }],
    "@babel/preset-typescript",
    "@babel/preset-react"
  ]
}

About @babel/core

Babel is the standard JavaScript compiler that transforms modern JavaScript and TypeScript syntax into backward-compatible versions that run in older browsers and environments. Babel parses source code into an abstract syntax tree (AST), applies a series of transformation plugins, and generates the output code with source maps. The plugin architecture is Babel's core strength — each syntax transformation is handled by a separate plugin, and plugins are grouped into presets for convenience. @babel/preset-env automatically determines which transformations and polyfills are needed based on your target browser/runtime configuration, using browserslist queries. @babel/preset-react handles JSX transformation, and @babel/preset-typescript strips TypeScript type annotations. Babel's plugin ecosystem includes transforms for decorators, class properties, optional chaining, pipeline operators, and numerous experimental proposals. While SWC and esbuild have become faster alternatives for straightforward compilation, Babel remains essential for projects using custom AST transforms, specialized syntax plugins, or Babel-specific features like babel-plugin-macros. Babel's infrastructure also powers tools like ESLint (via @babel/eslint-parser) and Prettier for parsing modern syntax.

Quick Facts

Package@babel/core
CategoryBuild Tool
Weekly Downloads30M+
LicenseMIT
Installnpm install -D @babel/core @babel/preset-env

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.