Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

babel vs babel-core vs babel-runtime

Tags:

babeljs

My node webpack project uses three babel libraries. What's the difference between these and how are they being used?

"dependencies": {   "babel-runtime": "^5.8.24" }  "dev-dependencies": {   "babel": "^5.8.23",   "babel-core": "^5.8.23" } 
like image 636
Kevin Wu Avatar asked Sep 12 '15 23:09

Kevin Wu


People also ask

What is difference between Babel-core and Babel-core?

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.

What is Babel runtime?

babel-runtime is a package that contains a polyfill and many other things that Babel can reference. You'd install it in your app with npm install babel-runtime. transform-runtime is a Babel plugin to process your source code and inject import foo from "babel-runtime" statements so that babel-runtime is actually used.

What does Babel transform runtime do?

A plugin that enables the re-use of Babel's injected helper code to save on codesize.

What is Babel-core used for?

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.


1 Answers

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.

like image 83
JMM Avatar answered Sep 23 '22 20:09

JMM