npm: why publish a package for client side?

I am having difficulties in understanding why there is a trend/need to use npm to publish a package that is 100% client-side and has no dependencies. For example, a simple class that extends HTMLElement can not be used in Node and "installation" consist of adding script tag to HTML file, and yet there are thousands of packages. Is it only for bundling? Kindly excuse my ignorance, but sometimes it is important to know "why" before "how". Thank you in advance.

This is general question. I have checked similar questions but most of them are "how-to".

>Solution :

Bundling is an important advantage, not worthy of the "just" label.

It also provides versioning automation (one quick npm outdated and you can see if any of your dependencies have new versions out, and npm audit will alert you to security vulnerabilities).

NPM also has its own search engine so it provides discoverability.

Leave a Reply