## glossary

What is Babel?

Babel is a JavaScript compiler that converts code written with modern syntax into equivalent code that older environments can execute. It is what lets you use the language’s latest features without waiting for every browser in use to support them.

The technical name for what it does is transpilation: compilation from one language to another at the same level of abstraction — JavaScript to JavaScript, not JavaScript to machine code.

What transpilation does in practice

Modern input, compatible output
// input — modern syntax
const somar = (a, b = 0) => a + b;

// output — ES5 equivalent
var somar = function (a, b) {
  if (b === void 0) {
    b = 0;
  }
  return a + b;
};

Presets and plugins

Babel on its own transforms nothing — it is a plugin infrastructure. Each plugin handles one specific transformation, and presets bundle coherent sets of them.

  • @babel/preset-env — the most used. It figures out which transformations are needed from the browsers you declare you support.
  • @babel/preset-react — converts JSX into function calls that React understands.
  • @babel/preset-typescript — strips TypeScript annotations (without checking types, just erasing them).
Configuration declaring the target, not the transformations
// babel.config.json
{
  "presets": [
    ["@babel/preset-env", {
      "targets": "> 0.5%, last 2 versions, not dead"
    }],
    "@babel/preset-react"
  ]
}

Transpilation is not polyfilling

This distinction causes frequent confusion. Babel transforms syntax — arrow functions, destructuring, classes. It does not create missing features, such as Promise or Array.prototype.includes. That is what polyfills are for: plain-JavaScript implementations of the missing feature, usually via core-js.

Is Babel still necessary?

Less than it used to be. With Internet Explorer gone and browsers updating themselves, a good share of projects can ship modern JavaScript directly. On top of that, newer tools — esbuild, SWC and the compiler of whichever bundler you use — transpile far faster, in Go or Rust. Babel remains relevant in legacy projects, in custom transformations and as the reference implementation of the spec.

## faq

Frequently asked questions

What is the difference between Babel and Webpack?

They do different things and usually work together. Babel translates the syntax of each file individually. Webpack bundles all the files and dependencies into optimized packages for the browser, calling Babel along the way.

Does Babel check type errors in TypeScript?

No. The TypeScript preset only strips the type annotations, without validating them. Checking is still done by the tsc compiler or by the editor. That is why projects using Babel with TypeScript usually run tsc --noEmit in parallel.

Do I need to configure Babel manually?

Rarely. Next.js, Vite and most modern tools ship with the configuration ready. Touching it directly is usually only necessary for custom transformations or projects with a bespoke build.