BASE

Babel

Babel

Build / code quality tool · Free

A JavaScript compiler with plugins and presets: it transforms project syntax for selected runtimes and supports creating code transforms.

Also known as: babel/babel; babeljs; babel-compiler

Resource illustration: Babel

Open resource ↗

What you can use for free

Code and local use under MIT.

Paid features and costs

Computing resources, self-hosting, and external services are paid for separately if used.

Access and limitations

Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.

Use cases

  • Transform JavaScript for target runtimes
  • Choose presets and plugins and compare source code with compilation results

Example workflow

A possible workflow; this is not a report of hands-on testing.

Transform JavaScript for target runtimes.

Before you start

  • A repository, package manifests, and configuration.
  • A compatible runtime and the target build command.
  • Target browsers/runtime, JSX or TypeScript in source code, required module output, and a separate type-checking command.

Steps

  1. Define supported runtimes and required syntax transforms. Set targets or an aligned Browserslist configuration for @babel/preset-env; changing targets affects transform selection.
  2. Choose presets and plugins and compare source code with compilation results. JSX uses a separate React preset, while the TypeScript preset removes type annotations. Consider required runtime APIs and polyfills separately; syntax transformation alone does not add every missing API.
  3. Include the process in scripts or CI with a clear report. A possible check runs the compiler, type checker, and tests separately in the target environment so successful JavaScript output does not conceal type errors.

Check your result

  • A clean copy of the project reproduces the result.
  • Errors produce a nonzero exit code and clear diagnostics.

Choosing Babel

Transform JavaScript for target runtimes

Choose this when

  • Transform JavaScript for target runtimes
  • Choose presets and plugins and compare source code with compilation results

Requirements

  • Define supported browsers or runtime versions and use documentation for the installed Babel version. Align plugin/preset configuration with the bundler; TypeScript type checking and polyfills are configured separately from syntax transformation.

Things to consider

  • Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
  • Terms of use: MIT for Babel code: use, modification, distribution, and sale are permitted with the copyright notice and permission text retained; code is provided without warranties. Dependencies and connected third-party packages have their own licenses.

Frequently asked questions

What can you use for free in Babel?

Code and local use under MIT.

What additional costs might arise with Babel?

Computing resources, self-hosting, and external services are paid for separately if used.

What terms of use matter for Babel?

MIT for Babel code: use, modification, distribution, and sale are permitted with the copyright notice and permission text retained; code is provided without warranties. Dependencies and connected third-party packages have their own licenses.

How do you get started with Babel?

Define supported runtimes and required syntax transforms. Set targets or an aligned Browserslist configuration for @babel/preset-env; changing targets affects transform selection. Choose presets and plugins and compare source code with compilation results. JSX uses a separate React preset, while the TypeScript preset removes type annotations. Consider required runtime APIs and polyfills separately; syntax transformation alone does not add every missing API. Include the process in scripts or CI with a clear report. A possible check runs the compiler, type checker, and tests separately in the target environment so successful JavaScript output does not conceal type errors.

What determines Babel's transformation result?

Babel transforms JavaScript based on the target environment and selected plugins/presets. The README links to documentation and the REPL; check specific configuration against project requirements.

Does Babel replace TypeScript checking?

No. Babel can remove TypeScript annotations and generate JavaScript, but it does not check types. The documentation recommends separate TypeScript or Flow type checking; successful transformation does not establish type correctness.

How do plugins, presets, and targets differ?

Plugins define individual transforms; presets group them. @babel/preset-env maps selected targets to required transforms; the documentation recommends Browserslist for shared browser configuration. Check installed-version parameters: available options change.

Why does compiled code still fail in an older browser?

Syntax transformation and runtime API availability are separate concerns. Babel describes polyfills through third-party packages such as core-js; appropriate configuration and actual environment testing are required. A possible sequence identifies an unsupported API, checks targets, then adds the required compatibility and a test.

License

MIT for Babel code: use, modification, distribution, and sale are permitted with the copyright notice and permission text retained; code is provided without warranties. Dependencies and connected third-party packages have their own licenses.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Technologies and topics

  • Babel
  • build
  • Development

Sources

Other resources