Babel.js is a JavaScript compiler. Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments.
Here are the main things Babel can do for you:
- Transform syntax
- Polyfill features that are missing in your target environment (through
@babel/polyfill
) - Source code transformations (codemods)
- And more! (check out these videos for inspiration)
Learn ES2015
Polyfill
It’s a service which accepts a request for a set of browser features and returns only the polyfills that are needed by the requesting browser.