I am new to Babel and JS and I wonder when and why to use @babel-core package instead of @babel-cli
Asked
Active
Viewed 1,348 times
1 Answers
2
From the official babel docs:
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.
This means that you can write your code in a version that is not compatible in some browsers then babel convert you code to make those browsers 'understand' it. This process of conversion is called compiling.
From the official babel docs:
Babel comes with a built-in CLI which can be used to compile files from the command line.
This means that @babel-cli comes inside of @babel-core. It is a tool that helps you work with babel. It helps you compile you code using the command line interface.

YulePale
- 6,688
- 16
- 46
- 95
-
thank you for your kind answer, the reason I decided to ask this question was that I found out babel package was divided into babel-cli and babel-core. Also, babel-cli should be installed to use babel in cli but babel-core to be used with Node API only. Is that right?. If so then what is node api briefly and how babel-core can be implemented inside node api just simple example. I tried to search what node api is but couldn't find clear article on that. – topGun Aug 15 '19 at 12:31
-
To understand what nodejs is I suggest [this video](https://www.youtube.com/watch?v=U8XF6AFGqlc). The example that you seek you can get from [this article](https://www.codementor.io/iykyvic/writing-your-nodejs-apps-using-es6-6dh0edw2o). Don't forget to accept the answer. – YulePale Aug 15 '19 at 13:03
-
accepted your answer, just a mere question will babel work if we do not install @babel/core? – topGun Aug 15 '19 at 13:10
-
No it will not. – YulePale Aug 15 '19 at 13:13