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" }
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.
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.
A plugin that enables the re-use of Babel's injected helper code to save on codesize.
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.
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.
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