Babel (JavaScript)
Rewrite new JavaScript for older browsers.
1. License
“Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction”
MIT allows use in paid and closed-source products.
github.com/babel/babel/blob/main/LICENSE3. Used by agents' projects
Dependency in 230 public GitHub projects set up for AI coding agents that we scanned (3.7%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What Babel (JavaScript) does
Babel is a free tool that rewrites JavaScript before it ships. It turns newer code, React's JSX tags and TypeScript into plain JavaScript that the browsers you choose can run. Most people never call it directly; a build or test tool runs it for them.
What people build with it
Support older phones and browsers
Your shop still has visitors on older iPhones; Babel rewrites newer code such as ?. and ?? so their browsers can run it.
TypeScript and JSX without the TypeScript compiler
A React component written in TypeScript becomes plain JavaScript in one step. Types are removed, not checked, so the build stays quick.
Run user code in a playground
A coding lesson site or an online sandbox compiles what visitors type, right in their browser, with no server.
Clean up code across a project
Remove every leftover debug print, rename an old function everywhere, or change an import style in hundreds of files with one small rule.
List what a file imports
A script reads each source file as a tree and reports which packages it imports, for a cleanup or a security review.
New React features in an existing build Idea
Tools such as the React Compiler ship as Babel plugins, so a project that already uses Babel adds them with one config line.
Babel (JavaScript) popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Babel (JavaScript) is used
- Babel (JavaScript) is a dependency in 230 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (4.7% of the 4,867 JavaScript/TypeScript ones), #4 of 185 in build tools and bundlers.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 749; those are left out of every share on this page.
- The most used alternative in our scan is esbuild (310 projects).
- Projects that use it most often also use Jest (43.9%), React (73.5%), ESLint (71.7%).
- It is more common in projects set up for OpenCode (5.5%) than for OpenClaw (2.4%).
By coding agent
Often used with
Babel (JavaScript) in practice
Strengths
You write current JavaScript and Babel rewrites the features your targets lack into code they can run. The README shows ES2020 nullish coalescing turned into a plain <code>!= null</code> check.
With <code>@babel/preset-typescript</code>, Artsy let Babel produce the JavaScript and kept <code>tsc</code> only for type-checking. Their summary of the result: "Proper type-checking, but compilation handled by Babel".
Since Babel 7, the core, presets and plugins all live in one monorepo and are published as <code>@babel/*</code> packages, such as <code>@babel/core</code> and <code>@babel/preset-react</code>.
The v8.0.7 release fixes bugs across the parser, traverse, helpers and several transform plugins. It also welcomes four first-time contributors.
Watch out for
Artsy's engineers warn that Babel setups take time to build and maintain. They also say some options can make interop with other environments hard.
Artsy quotes the TypeScript plugin's README: namespaces and const enums are not supported because they need type information. <code>export =</code> and <code>import =</code> are not supported either. The post dates from the Babel 7 beta.
This causes trouble when a dependency or preset turns on the Flow plugin. Artsy says the only fix is to drop that preset or patch the code that loads the plugin.
Nullish coalescing, before and after Babel
// ES2020 nullish coalescing
function greet(input) {
return input ?? "Hello world";
}
function greet(input) {
return input != null ? input : "Hello world";
}More about Babel (JavaScript)
Funding
- GitHub Sponsors: https://github.com/babel
- Open Collective: https://opencollective.com/babel
- 38 GitHub sponsors
Head to head
- Babel (JavaScript) vs SWC used together in 31 projects
Packages around it
- @babel/preset-env: Picks transforms for your targets
- @babel/preset-react: JSX and React preset
- @babel/preset-typescript: Compiles TypeScript
- @babel/runtime: Shared runtime helpers
- @babel/eslint-parser: Lets ESLint read Babel syntax
- @babel/parser: Babel's JavaScript parser
More in Build tools and bundlers
Alternatives
Babel (JavaScript) This page
Pick esbuild when you mostly need fast bundling and shrinking and do not need Babel's plugin system.
Pick SWC for a much faster compiler written in Rust that covers the common TypeScript and JSX cases.
Pick Vite for a whole dev server and build setup where you rarely touch the compiler yourself.
Module bundler that packages JavaScript, assets and dependencies for browser deployment.
Get started
Tell your AI assistant
“Set up Babel 8 (@babel/core 8.1.0 with @babel/preset-env, @babel/preset-react with runtime automatic and @babel/preset-typescript, Node.js 22.18+) with a top-level targets option, and keep tsc --noEmit for type checking.”
Install the core, the command-line tool and the main preset as development packages.
npm install --save-dev @babel/core @babel/cli @babel/preset-envSay which browsers you support. Without it, Babel 8 uses the browserslist "defaults" list (Babel 7 compiled for all browsers).
{ "targets": "defaults", "presets": ["@babel/preset-env"] }Compile the src folder into lib.
./node_modules/.bin/babel src --out-dir lib
Rules for your agent
## Babel
- Install the scoped packages (`@babel/core`, `@babel/preset-env`, `@babel/preset-react`, `@babel/preset-typescript`), not the old unscoped `babel-core` / `babel-preset-*` names.
- If a preset that is installed reports `Could not find preset`, run `yarn list babel-core` to look for an old Babel 6 copy pulled in by another tool, and pin it with a `resolutions` entry.
- When Babel compiles TypeScript, run `tsc` only for type-checking, with `"noEmit": true`; add `"skipLibCheck": true` if it reports errors inside `node_modules`.
- Do not write TypeScript `namespace`s, `const enum`s, `export =` or `import =` in code compiled by the Babel TypeScript plugin.
- Never enable the TypeScript and Flow plugins in the same config; remove any preset that turns on Flow, or depend on its individual plugins.
- With `babel-node`, pass `--extensions '.ts,.tsx'` and start from a `.ts` entry file; add `.ts`/`.tsx` to `babel-plugin-module-resolver`'s `extensions` option too.
- Check what a transform produces in the Babel REPL before changing presets or targets.
Mistakes to avoid
In Babel 8 transform needs a callback; the synchronous fallback was removed.
These plugins were renamed when the features became standard; the old package is deprecated on npm.
Babel 8 removed these options; some guide pages still show them in Babel 7 style.
Babel 7 compiled for every browser by default; Babel 8 compiles for browserslist defaults, so old browsers can break.
The default JSX runtime changed from classic to automatic in Babel 8.
Questions
Does Babel check my TypeScript types?
No. It only removes them; run the TypeScript checker separately.
Which browsers does Babel 8 compile for by default?
The browserslist "defaults" list, which covers most modern browsers. Babel 7 compiled for all browsers by default.
Can I use Babel in the browser?
Yes, with @babel/standalone, mainly for playgrounds and prototypes; config files do not work there.
Can I write my own code changes with it?
Yes. Babel is built from plugins, and you can write your own to change code in any way.
Can I use it in a paid product?
Yes. Babel is MIT licensed; keep the notice with copies of its code.