# Babel (JavaScript) — card for AI agents

JavaScript compiler for transforming modern JavaScript to compatible code.

Category: Build tools and bundlers · npm package `@babel/core` · latest version 8.0.10 (checked 2026-11-01)
Install: `npm install @babel/core`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## 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.

## What it is
- Babel is a JavaScript compiler. The README says it "helps you write code in the latest version of JavaScript". When the environments you support lack a feature natively, Babel compiles that feature down to a supported version. The README's own example turns `input ?? "Hello world"` into `input != null ? input : "Hello world"`.
- The GitHub repository was created on 2014-09-28 and is MIT licensed. The project is a monorepo of many npm packages published under the `@babel` scope. The website announces Babel 8.0.0, and the releases page lists v8.0.7 as the latest release. The maintainers describe themselves as a small group of volunteers funded by the community.
- It is for developers who want to use newer JavaScript syntax but still ship code their targets can run. Through presets it also handles JSX and TypeScript. Artsy, for example, used it to compile TypeScript for its React Native and web apps.

## Caveats
- Config takes ongoing work: 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.
- Some TypeScript features are out of reach: Artsy quotes the TypeScript plugin's README: namespaces and const enums are not supported because they need type information. `export =` and `import =` are not supported either. The post dates from the Babel 7 beta.
- TypeScript and Flow plugins cannot be loaded together: 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.
- Major upgrades can break your tools: When Babel moved from 6 to 7, tools that pointed at the old `babel-core` package broke, and errors like `Could not find preset` were hard to trace. Artsy fixed it with `babel-bridge` and a yarn `resolutions` override.
- Run by a handful of volunteers: The README says most of the maintenance is done by a few volunteers. They rely on sponsorship through Open Collective and GitHub.

## Numbers (AgentGid data)
- Gid Score: 84.1 (#47 of all tools, 4 of 185 in its category)
- Used in 230 public projects set up for AI coding agents (3.7%)
- Downloads last week: 270,859,571 (as of 2026-11-24), +39.7% over 4 weeks
- GitHub stars: 44,074 (as of 2026-11-24)
- Last push: 2026-11-24

## Often used with
Jest 43.9%, React 73.5%, ESLint 71.7%, React Native 34.3%, Testing Library 36.5%, TypeScript 83.0%

## Checked alternatives (same job)
- esbuild: https://agentgid.com/tools/esbuild/agent.md
- SWC: https://agentgid.com/tools/swc-core/agent.md
- webpack: https://agentgid.com/tools/webpack/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/babel-npm/
- Homepage: https://babel.dev/docs/en/next/babel-core
- Repository: https://github.com/babel/babel
- Source: https://github.com/babel/babel#readme
- Source: https://github.com/babel/babel
- Source: https://github.com/babel/babel/releases
- Source: https://babel.dev


## Babel: rewrite new JavaScript for older browsers

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.

### Where to use 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: Tools such as the React Compiler ship as Babel plugins, so a project that already uses Babel adds them with one config line. (idea, not from the official pages)

### How to start
- Install the core, the command-line tool and the main preset as development packages.

```
npm install --save-dev @babel/core @babel/cli @babel/preset-env
```

- Say 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
```


### License
Free to use, also in paid and closed-source products, under the MIT license. Keep the copyright and permission notice with copies of Babel's code.

### Good to know
- Babel 8 came out in June 2026 and needs Node.js 22.18 or 24.11 and newer. It is published only as modern modules.
- It does not check TypeScript types. A wrong type passes straight through, so keep the TypeScript checker in your tests.
- Mixing Babel 7 and Babel 8 packages is not supported; upgrade the core, presets and plugins together.
- The browser build compiles in the visitor's browser and is large; the docs advise against it for live sites.
- Babel 7 still gets fixes (7.29.13 on November 4, 2026), so older setups keep working while you plan the move.

Checked 2026-11-10 against: https://babeljs.io/docs/, https://babeljs.io/docs/usage, https://babeljs.io/docs/v8-migration, https://babeljs.io/docs/v8-migration-api, https://babeljs.io/docs/babel-core, https://babeljs.io/docs/babel-standalone, https://babeljs.io/docs/babel-preset-env, https://babeljs.io/docs/babel-preset-react, https://babeljs.io/docs/babel-preset-typescript, https://babeljs.io/docs/babel-parser, https://babeljs.io/docs/babel-cli, https://babeljs.io/docs/babel-runtime, https://babeljs.io/docs/babel-plugin-transform-runtime, https://babeljs.io/docs/configuration, https://github.com/babel/babel/blob/main/LICENSE, https://github.com/babel/babel/blob/main/README.md, https://registry.npmjs.org/@babel/core, https://registry.npmjs.org/@babel/core/8.1.0, https://registry.npmjs.org/@babel/standalone, https://registry.npmjs.org/@babel/plugin-proposal-class-properties

### Mistakes to avoid
- Don't: babel.transform(code, options) used synchronously with @babel/core 8 → Do: babel.transformSync(code, options) or await babel.transformAsync(code, options) (In Babel 8 transform needs a callback; the synchronous fallback was removed.)
- Don't: "@babel/plugin-proposal-class-properties" (and other -proposal- plugins) in a Babel 8 config → Do: Use the -transform- name, e.g. @babel/plugin-transform-class-properties, or drop it since preset-env includes it (These plugins were renamed when the features became standard; the old package is deprecated on npm.)
- Don't: Copying useBuiltIns: "usage" and corejs into @babel/preset-env options in Babel 8 → Do: Remove both and add babel-plugin-polyfill-corejs3 for polyfills (Babel 8 removed these options; some guide pages still show them in Babel 7 style.)
- Don't: Leaving out targets after upgrading and expecting the same output as Babel 7 → Do: Set a top-level "targets" (or a .browserslistrc file) to the browsers you really support (Babel 7 compiled for every browser by default; Babel 8 compiles for browserslist defaults, so old browsers can break.)
- Don't: Relying on the React preset's old "classic" default (React.createElement) after the upgrade → Do: Set runtime explicitly: "automatic" for React 17+, or "classic" with useSpread: true if you keep it (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.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
