Babel is a transpiler that convert cutting edge/experimental/exotic JavaScript syntax into the ES5 syntax that the JavaScript engines in browser/node environment can execute.
Use cases
- Transpile ES6 syntax into ES5 syntax
- Transpile JSX syntax (the one used by React) into pure JavaScript
Babel supports a plugin based architecture to make the transpiling process configurable.
You need to configure in your project root directory, using babel.config.js
or .babelrc
file. More details can be found in their official documentation
If you don't want to configure the set of babel plugins by yourself, you can also use pre-defined set of plugins called presets such as preset-env and preset-react