We've gone down this rabbit hole with Fusion.js . The TL;DR: is core.js aims to be standard-compliant, which means it'll often pull in a lot of code to deal with obscure corner cases like dealing w/ Symbols. You can get around this a few different ways: configure webpack/babel to not polyfill certain features (meaning, you lose support for old browsers) provide custom polyfills (meaning you still have support for old browsers, but your implementation may be susceptible to brokenness of obscure edge cases) not use core.js and instead expose a module field in package.json (or browser, etc, depending on how the package is consumed) and let the consumer's build pipeline figure out what to do wrt module transpilation (meaning you mostly provide source code, and the consumer has to decide how much standards compliance they want vs how much they can get away with simpler polyfills) The last option has the most potential for performance gains because a consumer may choose to conditionally transpile depending on whether the user agent is a modern browser, meaning e.g. Chrome gets the terse and sweet ES6 code whereas a playstation browser would get the ES5 bundle (this is what we do w/ Fusion.js). But mind that this approach requires some more infrastructure on the consumer side. We've built it into our framework, and I'm aware of a few others that do similar stuff (Meteor, for example), but not all frameworks do. Note also that the last option is not mutually exclusive with transpiling options. You can still provide a transpiled main field in package.json to support bundler setups that don't support the module field. Answer from lhorie on reddit.com
🌐
Reddit
reddit.com › r/node › babel-core vs babel-loader
r/node on Reddit: Babel-core Vs Babel-loader
August 6, 2019 - Bable-core if you want to use babel in your real project, you need to install babel but there's no babel package available. babel split it up into…
🌐
Reddit
reddit.com › r/node › babel-cli vs babel-preset-es2015 vs babel-register vs babel-core?
r/node on Reddit: babel-cli vs babel-preset-es2015 vs babel-register vs babel-core?
June 5, 2016 -

What are all these babel dependencies? What are each of them for and how do they differ? Which one should I use for my nodejs web app?

I have looked on the API website but is there any guide that puts these into simple human English?

Top answer
1 of 1
26
Node actually has pretty good support for ES2015 now, so depending on which version of Node you're targeting, and which ES2015 features you're looking to use, you might not even need to use babel. That being said: babel-cli This gives you two scripts to use on the command line: babel: compiles your code babel-node: like the normal node command, only everything gets run through babel first You don't really need this, but babel-node can be handy for debugging. Do not use babel-node in production. babel-preset-es2015 Babel works by running your code through a bunch of plugins, each of which is responsible for performing one or more transformations on your code. On npm, babel plugins are almost always prefixed with babel-plugin-, e.g. babel-plugin-transform-es2015-arrow-functions, which converts arrow functions to normal functions. Presets are just bundles of plugins. For example, babel-preset-es2015 contains every plugin you need to transform code from the ES2015 spec to es5 spec. You could require each plugin separately, but that would be tedious. What happens if you don't include any plugins or presets? Nothing. Babel will run just fine, but it won't transform your code in any way, because it doesn't have any plugins to tell it what to transform. You should probably use either babel-preset-es2015 or babel-preset-es2015-node , which only includes plugins for ES2015 features that are not yet natively supported by Node. babel-register If you put this in a module, any subsequent file loaded using require will be automatically transpiled by babel. A common pattern is to set up a transpilation entry point for your app that looks something like this: // set up the `require`-hook require('babel-register'); // load your actual app, which will // now be transpiled by babel require('./path/to/main/app.js'); Then instead of calling your main app file (e.g. node app.js), you call this transpiling one (e.g. node app.babel.js), and ta-da! you to get the benefits of babel without having to run a build step every time you change your code. NB: The file containing require('babel-register') will not be transpiled. Code required by the file will be transpiled, but not the code in the file itself. You probably want to use this. It will make your life much easier. babel-core This is needed if you plan to require the babel transpiling engine directly in your own code. You probably don't need this
🌐
Reddit
reddit.com › r/reactjs › [deleted by user]
[deleted by user] : r/reactjs
March 2, 2021 - core-js v2 is very large (i'm not sure about v3) even if you only use a few polyfills, because all its internal modules depend on its other polyfill modules rather than on globals.
🌐
Reddit
reddit.com › r/learnjavascript › is babel/corejs really necessary?
Is Babel/CoreJS Really Necessary? : r/learnjavascript
April 3, 2024 - As to coreJS, it’s probably not needed for most stuff these days unless you are chasing the bleeding edge, but it’ll continue to be necessary as long as new features are added to JS and you want to use them while guaranteeing backward compatibility.
🌐
Reddit
reddit.com › r/javascript › [askjs] is it just me or is core-js fundamentally broken?
r/javascript on Reddit: [AskJS] Is it just me or is core-js fundamentally broken?
May 5, 2021 -

I've been using core-js with Babel for years in fairly large-scale projects where the bloat it produces has been somewhat disguised by the fact bundles are pretty big regardless. The pros of everything just working for a target environment outweigh any cons, and I think this is where core-js really shines.

However, I've recently started building some minimal NPM packages and it's been an eye-opener for me. So much so that I'm questioning whether core-js is fundamentally broken or if I'm just not fully understanding its purpose or how to leverage it properly.

Assume I'm targeting IE11 specifically and take the following example:

function trimmer(value) {
    return value.trim();
}

There is nothing fancy here; String.prototype.trim() has been supported since IE10.

Running this through Babel with core-js enabled appends require("core-js/modules/es.string.trim.js"); which then creates a chain reaction of dependency bloat. In fact if you use @rollup/plugin-commonjs to include these files in the bundle you end up with nearly 600 lines of code. Let that sink in. That's a 60000% increase for something that didn't even need polyfilling.

Even if a polyfill was required, why the bloat? There's a one-liner on MDN which probably covers 99.9% of cases.

Perhaps this is a bug, so let's move on to another example:

const test = {
    ...{
        foo: 'bar'
    }
};

Spread in object literals is not supported in IE11. That's fine.

If you forego core-js and simply use preset-env then a small block of helper code is injected to polyfill Object.assign(). The same is true when using TSC and compiling to <= ES5. You can take either of these outputs and run them in IE11 with no issues.

If you enable core-js the compiled output grows to over 1300 lines of code.

I'm clearly missing something as there is no way this is even remotely acceptable.

I'm wondering if anyone out there is/was in a similar position to me or can offer some advice.

The opinion I'm leaning toward at the moment is that core-js is great for large-scale projects where the overhead is mostly negated, and you have the peace of mind knowing that everything will just work. For smaller projects, if you're targeting a legacy environment then be conscious of the code you're writing (e.g. use a traditional for loop rather than for...of if it means avoiding 10 extra lines of polyfill code) and include case-specific polyfills manually if there's no other choice.

Top answer
1 of 15
50

I'm 100% with you! I've been maintaining a list of core-js modules not to polyfill for the projects I manage. These can be disabled using the `exclude` option in babel.config.js. Feel free to use and/or provide corrections if you discover any additional ones!

2 of 15
35

We've gone down this rabbit hole with Fusion.js. The TL;DR: is core.js aims to be standard-compliant, which means it'll often pull in a lot of code to deal with obscure corner cases like dealing w/ Symbols.

You can get around this a few different ways:

  • configure webpack/babel to not polyfill certain features (meaning, you lose support for old browsers)

  • provide custom polyfills (meaning you still have support for old browsers, but your implementation may be susceptible to brokenness of obscure edge cases)

  • not use core.js and instead expose a module field in package.json (or browser, etc, depending on how the package is consumed) and let the consumer's build pipeline figure out what to do wrt module transpilation (meaning you mostly provide source code, and the consumer has to decide how much standards compliance they want vs how much they can get away with simpler polyfills)

The last option has the most potential for performance gains because a consumer may choose to conditionally transpile depending on whether the user agent is a modern browser, meaning e.g. Chrome gets the terse and sweet ES6 code whereas a playstation browser would get the ES5 bundle (this is what we do w/ Fusion.js). But mind that this approach requires some more infrastructure on the consumer side. We've built it into our framework, and I'm aware of a few others that do similar stuff (Meteor, for example), but not all frameworks do.

Note also that the last option is not mutually exclusive with transpiling options. You can still provide a transpiled main field in package.json to support bundler setups that don't support the module field.

🌐
Reddit
reddit.com › r/typescript › choosing a typescript transpiler: babel vs. swc vs. sucrase
r/typescript on Reddit: Choosing a TypeScript Transpiler: Babel vs. swc vs. Sucrase
April 12, 2024 -

I'm currently evaluating different TypeScript transpilers for a new project I'm working on and am trying to decide between Babel, swc, and Sucrase. I’ve read up on each, but I would love to hear from others who have firsthand experience with these tools.

  1. Performance: Which of these transpilers offers the best build performance? I'm particularly interested in faster compile times during development.

  2. Ease of Use: Is there a significant difference in the ease of setup and configuration between these transpilers?

  3. Feature Support: Considering Babel's comprehensive support for experimental features versus the more streamlined approaches of swc and Sucrase, how does this affect your day-to-day development? Do swc or Sucrase miss out on any crucial features?

  4. Community and Support: Which of these tools has a more active community and better support? Have you encountered any issues, and how responsive were the maintainers?

Any insights, benchmarks, or personal experiences you could share would be greatly appreciated. Looking forward to your advice to help me make an informed decision.

Thank you!

Top answer
1 of 5
15
To answer your question, although probably not as comprehensively as you'd like: Babel is the slowest and unless you plan to use experimental language features before they're Stage 4 or you can't live without some features that are only available with Babel plugins (e.g. macros) I would not use it, but it's a very stable and safe choice swc has Vercel's backing as it's used by Next.js and it's very fast, I would pick this one out of the three I haven't heard of Sucrase, doesn't seem to be a very active project and even if it's very fast I'd be wary of using a niche project for something like that, ironically tsup which I'm recommending later is using it under the hood but only for CJS splitting which esbuild doesn't support + seems like Tailwind inflates this package's usage but they use it for a very minor thing Now the question is what kind of project are you going to build? Because frankly I probably wouldn't use any of these directly but rather use something like tsx or tsup for Node and Vite for frontend development (if you're going to use Bun or Deno the problem does not exist). Coincidentally all 3 use esbuild which you didn't mention in your post, but the reason why I'd use those is because they "just work". Transpiling is something I don't want to care about, I had to deal with Babel/Webpack config nightmares for most of my career and I don't want to do that anymore. All of these are waaay faster than tsc and that's enough for me. If you have very special requirements I'm afraid you'll have to make a judgement yourself based on those.
2 of 5
12
I only use esbuild these days. So much faster than the others, really easy to set up, and pretty simple to modify with custom plugins if you need.
🌐
Reddit
reddit.com › r/javascript › [askjs] do i need babel/core-js with vite.js?
r/javascript on Reddit: [AskJS] do I need babel/core-js with vite.js?
March 1, 2025 -

I've looked into this topic for some time and it's confusing.

I only care about "modern browsers". And it seems like vite.js premise is - use esbuild and you dont need the core-js/babel - is that correct?

But couldn't there be a possibility that feature is supported in all browsers except like safari or firefox - and so even if browser is "modern" - it still would require a polyfill? so to me it seems like babel/core-js is still kind of good to have with vite.js?

What's your take on it? do you use babel with vite.js?

Find elsewhere
🌐
npm
npmjs.com › package › @babel › core
babel/core
May 25, 2026 - Babel compiler core.. Latest version: 8.0.1, last published: a month ago. Start using @babel/core in your project by running `npm i @babel/core`. There are 24154 other projects in the npm registry using @babel/core.
      » npm install @babel/core
    
Published   Jun 17, 2026
Version   8.0.1
🌐
GitHub
github.com › babel › babel › discussions › 12605
What's the best practice of babel & core-js? · babel/babel · Discussion #12605
When I use core-js with babel, I want to try my best to reduce the output file size. So I will configure babel to import only some polyfills. First, I use @babel/preset-env with useBuiltIns: usage ...
Author   babel
Top answer
1 of 1
94

babel

Babel doesn't do anything,It basically acts like const babel = code => code; 
by parsing the code and then generating the same code back out again.

You will need to add some plugins for Babel to do anything like transpiling es6,JSX.

babel-core

if you want to use babel in your real project, you need to install babel but 
there's no babel package available.

   babel split it up into two separate packages: babel-cli and babel-core

   **babel-cli** : which can be used to compile files from the command line.

   **babel-core** : if you want to use the Node API you can install babel-
      core, Same as "babel-cli" except you would use it programmatically inside your app.

   use "babel-cli" or "babel-core" to compile your files before production.

before move on,

preset vs plugin :

We can add features(es6,JSX) one at a time with babel plugins(es2015), 
    or 
we can use babel presets to include all the features(es6) of a particular year.

Presets make setup easier.

babel-preset-es2015

babel-preset-env supports es2015 features and replaces es2015, es2016, 
  es2017 and latest.

So use babel-preset-env, it behaves exactly the same as babel-preset-latest 
 (or babel-preset-es2015, babel-preset-es2016, and babel-preset-es2017 together).

babel-preset-react

transform JSX into createElement calls like transforming react pure class to 
   function and transform react remove prop-types.

babel-polyfill

Without babel-polyfill, babel only allows you to use features like arrow 
 functions, destructuring, default arguments, and other syntax-specific 
 features introduced in ES6.

The new ES6 built-ins like Set, Map and Promise must be polyfilled

To include the polyfill you need to require it at the top of the entry point 
  to your application. 

babel-loader

you done with babel-core, babel-cli, and why need preset, plugins and now 
  you are compiling ES6 to ES5 on a file-by-file basis by babel-cli every time.

to get rid-off this, you need to bundle the task/js file. For that you need 
   Webpack.

Loaders are kind of like “tasks”, They gives the ability to leverage 
 webpack's bundling capabilities for all kinds of files by converting them 
 to valid modules that webpack can process.

Webpack has great Babel support through babel-loader

devDependencies

When you deploy your app, modules in dependencies need to be installed or 
your app won't work. Modules in devDependencies don't need to be installed 
on the production server since you're not developing on that machine.

These packages are only needed for development and testing.

Isn't there any single dependency to replace them all?

as you read the above states, You need some presets and loaders to transpile 
 es2015 or JSX files.

babel -> @babel

Since Babel 7 the Babel team switched to scoped packages, so you now 
have to use @babel/core instead of babel-core.

Your dependencies will need to be modified like so:

babel-cli -> @babel/cli. Ex:  babel- with @babel/.
Top answer
1 of 3
46

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.

2 of 3
21

TL;DR The things to compare here are:

  1. babel (use for 5.x.x) vs babel-cli+babel-core (pick one for 6.x.x)
  2. babel-polyfill (use for non-libraries) vs babel-runtime+babel-plugin-transform-runtime (use for libraries)

From https://babeljs.io/blog/2015/10/31/setting-up-babel-6:

The babel package is no more. Previously, it was the entire compiler and all the transforms plus a bunch of CLI tools, but this lead to unnecessarily large downloads and was a bit confusing. Now we’ve split it up into two separate packages: babel-cli and babel-core.

npm install --global babel-cli

or

npm install --save-dev babel-core

If you want to use Babel from the CLI you can install babel-cli or if you want to use the Node API you can install babel-core.

babel-runtime just allows polyfills that don't pollute the global space, unlike babel-polyfill which pollutes your global space. From http://babeljs.io/docs/plugins/transform-runtime/:

[babel-runtime] automatically polyfills your code without polluting globals. (This plugin is recommended in a library/tool)

If you use babel-runtime, you should also

npm install --save-dev babel-plugin-transform-runtime

In most cases, you should install babel-plugin-transform-runtime as a development dependency (with --save-dev) and babel-runtime as a production dependency (with --save).

The transformation plugin is typically used only in development, but the runtime itself will be depended on by your deployed/published code.

Also, babel-runtime+babel-plugin-transform-runtime and babel-polyfill are generally mutually exclusive--meaning you should only use one or the other. From a comment here http://jamesknelson.com/the-six-things-you-need-to-know-about-babel-6/:

You should be using either babel-polyfill or babel-runtime. They are mutually exclusive—unless of course you know what you are doing. But they are essentially the same thing. These are just helpers. babel-polyfill achieves the same goal by mutating globals whereas babel-runtime does so modularly. Unless you are developing a library, I’d recommend you use the polyfill.

🌐
GitHub
github.com › babel › babel › issues › 6824
@babel/core required even when using old babel-core (7.0.0-beta.3) · Issue #6824 · babel/babel
November 14, 2017 - Hello, Today I came to work, reinstalled my dependencies, and ran into a strange problem. I'm using older beta-version of babel (7.0.0-beta.3). When trying to build my (react) project as usual, I g...
Author   babel
🌐
Reddit
reddit.com › r › node › comments › du0y86 › do_i_need_the_corejs_polyfill_for_babel_7_if_im
r/node - Do I need the core-js polyfill for babel 7 if I’m not using generators?
November 10, 2019 -

I’m using babel (with preset-env) for “modern” es2015+ support with node 8 LTS.

My app has two entry points - babel-register-based, and another which calls the transpiled script in a dist folder. I require(“core-js/stable”) first in both. I’ve also set the following preset-env flags in my babel config useBuiltIns: “usage, corejs: 3”

Is this needed in a node environment? If so, why? Been running in circles on this one

🌐
GitHub
github.com › zloirock › core-js › issues › 905
What's the best practice of babel & core-js? · Issue #905 · zloirock/core-js
January 6, 2021 - When I use core-js with babel, I want to try my best to reduce the output file size. So I will configure babel to import only some polyfills. First, I use @babel/preset-env with useBuiltIns: usage ...
Author   zloirock
🌐
npm
npmjs.com › package › babel-core
babel-core - npm
April 27, 2018 - Babel compiler core.. Latest version: 6.26.3, last published: 8 years ago. Start using babel-core in your project by running `npm i babel-core`. There are 12187 other projects in the npm registry using babel-core.
      » npm install babel-core
    
Published   Apr 27, 2018
Version   6.26.3
🌐
Stack Overflow
stackoverflow.com › questions › tagged › babel-core
Newest 'babel-core' Questions - Stack Overflow
I would like to update the version of the @babel/core lib inside of the package.json of the react-scripts (it was installed @5.0.1), can i achieve that through npm run eject ?