3

So today I learnt that babel/runtime-corejs2 is a lib which makes babel more optimised by refactoring most of its function calls. So I need to import a library..... to gain more performance out of an existing library.... I mean you could literally refactor babel instead of asking people to import another package in your project 🤦‍♂️

Comments
  • 0
    What's keeping you back? 😊

    The babel team has a bunch to do and probably reasons not to refactor everything while it works.

    Why would you need to optimize a static lib? It's only used in compilation, not runtime right?
  • 0
    @Kandelborg it is shipped as a direct dependency which adds the bundle size of the project. Besides, if they have lots to do and figured to release a new library in their busy schedule, the better use of the time would be to refractor the existing one IMHO.
  • 0
    @varundey Make it a dev dependency?

    I'm really unclear on the problem now. Why are you bundling babel?

    Also, they haven't released a new lib. They've reorganised their current lib.
  • 0
    @Kandelborg we are not bundling babel. Only babel/runtime-corejs2. This is needed as a runtime dependency.
  • 0
    @varundey Fair enough. I don't quite get the usecase for babel-runtime as I'd always compile code for the targeted platform. Especially to avoid a whole runtime on top of my runtime. I don't know why the runtime or the optimiser even should exist

    Of course, you might have to for some reason and I'm not attacking that part at all. You're probably super awesome 😊.

    I just don't see the case for extra runtimes. I use esnext with ts and I just choose my targeted es version. Oh and I might be oblivious and a newbie, please correct me then. I know there's an argument around bundle size and maybe target audience?
  • 0
    babel-runtime optimises the babel generated code by injecting code which changes the reference of how babel functions are called.. Thus optimising the app performance. I am trying to get my head around the same question - why does this even exist when it could be taken care in babel itself.

    You ask a good question, but isn't bundle size argument an external plugin? Also we have the target audience set as all the browsers >= es6.

    Also, you're very kind for the internet. Have a great day/night :)
Add Comment