What is the difference between babel-core and @babel/core ?
Are they the same thing but different versions? If not so, when do you use one and when do you use the other?
Thank you.
Babel 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.
You can also check the version of babel-cli by finding the babel-cli folder in node_modules and looking at the version property of the package. json that is at the base of that folder. If babel-cli was installed globally via -g flag of npm install , you could check the version by executing command babel --version .
Babel 7.18 is released!
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4 proposals) and is intended to be used in an application rather than a library/tool. (this polyfill is automatically loaded when using babel-node ).
babel-core is the API. For v5 the babel package is the CLI and depends on babel-core. For v6, the babel-cli package is the CLI (the CLI bin command is still babel though) and the babel package doesn't do anything. babel-runtime I guess is just the runtime (polyfill and helpers) to support code that's already been transformed.
3 Answers. babel-cli, which contains the babel command line interface babel-core, which contains the Node API and require hook babel-polyfill, which when required, sets you up with a full ES2015-ish environment To avoid accidental conflicts, make sure to remove any previous Babel packages like babel, babel-core, etc.
For v5 the babelpackage is the CLI and depends on babel-core. For v6, the babel-clipackage is the CLI (the CLI bin command is still babelthough) and the babelpackage doesn't do anything.
Since Babel 7 the Babel team switched to scoped packages, so you now have to use @babel/core
instead of babel-core
.
But in essence, @babel/core
is just a newer version of babel-core
.
This is done to make a better distinction which packages are official and which are third-party.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With