From the series Front end
This is further complicated by the whole jQuery plugin ecosystem. It's sorely tempting to keep pulling in an off-the-shelf plugin every time you add some new functionality, but doing that can cause your bundle size to snowball, far more than implementing the functionality yourself. The quality of jQuery plugins can be highly variable, with plenty being bloated messes that cause a lot of problems. Some may still be using legacy methods, making them reliant on not just jQuery, but jQuery Migrate too, further bloating the bundle. And if you're using React or Vue alongside jQuery in your project (often the case for legacy applications), trying to integrate the plugin with them can be a nightmare - plenty of plugins don't clear up after themselves properly, messing up the DOM in the process.
If you need something to manipulate the DOM, but the project isn't complex enough to merit considering something like React.js or Vue.js, consider using Alpine.js, which has a similar declarative style to Vue, but is a fraction of the size and can be more easily applied when you only need a little interactivity. If you need a way to make AJAX requests and can't rely on the presence of the
fetch() function, consider using Axios. These two libraries, together, are only a fifth the size of jQuery, but can do the overwhelming majority of what it can.