DEV Community

Andreas B. Vestergaard
Andreas B. Vestergaard

Posted on • Updated on

How do I know if I need Core-js as a dependency?

I recently dove deep into all the different npm packages we are using on one of our projects, and I started wondering how to proper test if we really need core-js as a devDependency.

I am having a hard time figuring out how to test if we need it or not - and would love to hear from you 👌

Is core-js still relevant and are there good alternatives?

🦄

Top comments (2)

Collapse
 
mihneasim profile image
Mihnea Simian

My team also uses core-js - it's actively maintained, why look for an alternative?

At the start of this year we solved a production incident by updating our core-js version. It seems somebody used Array.prototype.toSorted without checking the compatibility table - it has just been introduced in 2023, so any visitor not using Chrome 110 or newer suffered a terminal runtime error on our web app. Luckily all we needed to do is update core-js to latest!

If you used it in conjunction with Babel, then you don't need to ask yourself whether it's needed or not - the babel core-js preset will simply include only the required polyfills for your build, at build time.

Collapse
 
aboesig profile image
Andreas B. Vestergaard

Thanks for your input @mihneasim 👌

I was just curious about where we are currently with modern browsers with regards to supporting modern JS for example.

I also think I got a bit scared when I read this update from the core-js creator:

github.com/zloirock/core-js/blob/m...