Babel is a
free and
open-source JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
transcompiler
A source-to-source translator, source-to-source compiler (S2S compiler), transcompiler, or transpiler is a type of translator that takes the source code of a program written in a programming language as its input and produces an equivalent so ...
that is mainly used to convert
ECMAScript 2015+ (ES6+) code into backwards-compatible
JavaScript
JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
code that can be run by older
JavaScript engine
A JavaScript engine is a software component that executes JavaScript code. The first JavaScript engines were mere interpreters, but all relevant modern engines use just-in-time compilation for improved performance.
JavaScript engines are typica ...
s. It allows web developers to take advantage of the newest features of the language.
Developers can use new JavaScript language features by using Babel to convert their source code into versions of JavaScript that a
Web browser
A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
can process. Babel is used to compile
TypeScript
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large app ...
into JavaScript. The core version of Babel was downloaded 5 million times a month in 2016, and this increased to 16 million times a week in 2019.
Babel plugins transform syntax that is not widely supported into a backward-compatible version. For example,
arrow functions, which are specified in ES6, are converted into regular function declarations. Non-standard JavaScript syntax such as
JSX can also be transformed.
Babel can automatically inject
polyfills provided by core-js
for support features that are missing entirely from JavaScript environments. For example, static methods such as
Array.from
and
built-ins such as
Promise
are available only in ES6 and above, but they can be used in older environments if core-js is used.
See also
*
Comparison of web browsers
*
TypeScript
TypeScript is a free and open source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large app ...
*
Web development tools
*
Webpack JavaScript bundler
*
JavaScript library A JavaScript library is a library of pre-written JavaScript code that allows for easier development of JavaScript-based applications, especially for AJAX and other web-centric technologies.
Libraries
With the expanded demands for JavaScript, an ea ...
References
External links
*
GitHub projectOrigin story
{{JavaScript
Compilers
Free software
JavaScript programming tools
Software using the MIT license
Source-to-source compilers