Babel (JavaScript 转译器)

Babel — MIT licensed JavaScript compiler for using next-generation JavaScript today

About Babel

Babel is a JavaScript compiler. The official site describes it as a way to use next-generation JavaScript today, which means developers can write modern syntax and transform it for environments that do not yet support it natively.

Babel is widely used for:

  • transpiling modern JavaScript syntax
  • supporting older runtimes and browsers
  • React and JSX toolchains
  • library and framework builds
  • plugin and preset-based transformation pipelines

Created by: Sebastian McKenzie First released: 2014 Primary language: JavaScript License: MIT License

Babel became popular because it sits in the middle of the JavaScript ecosystem and makes modern syntax practical for real-world deployment. It helps teams adopt new language features without waiting for every target platform to catch up. The official site presents Babel as a compiler for next-generation JavaScript.

Its strengths include:

  • Transforms modern syntax into broadly supported JavaScript
  • Flexible plugin system for custom workflows
  • Preset ecosystem for common language and framework setups
  • Strong integration with bundlers and build tools
  • Essential role in many frontend toolchains

Common Use Cases

Transpilation

Babel is used to convert modern JavaScript syntax into code that can run on older browsers or runtimes.

Framework Tooling

It is frequently part of React and other framework-based build pipelines.

Library Builds

Library authors use Babel to produce distributable bundles and maintain compatibility with multiple environments.

Custom Language Features

Teams can use Babel plugins to experiment with syntax transforms and codemods.

Build Automation

Babel often sits alongside bundlers, linters, and test tooling to make the JavaScript build process consistent.

Technical Notes

Babel is built around a parser, transform pipeline, and generator. Source code is parsed into an AST, transformed by plugins and presets, and then emitted as runnable JavaScript. That architecture makes Babel highly extensible and widely reusable across tools.

Important concepts include:

  • AST-based transforms
  • plugins and presets
  • JSX and TypeScript-related workflows
  • source transformation for multiple targets
  • integration with bundlers and compilers

License Information

Babel is distributed under the MIT License.

The current license notice is:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
MIT License

Copyright (c) 2014-present Sebastian McKenzie and other contributors

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, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

If you use Babel in your project, keep the MIT License text and attribution together with your distribution.

How to Attribute Babel in Your Project

In README.md

1
This project uses [Babel](https://babeljs.io/) © Sebastian McKenzie and other contributors, MIT License.

In About / Credits page

1
2
Babel - Copyright (c) 2014-present Sebastian McKenzie and other contributors - MIT License
https://github.com/babel/babel/blob/main/LICENSE
1
2
Babel JavaScript compiler, MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors

Resources