Frontend Development

Why you shouldn't use jQuery and moving away from it

Submitted by null0r, , Thread ID: 122150

Thread Closed

RE: Why you shouldn't use jQuery and moving away from it

OP
#5
24-02-2019, 04:50 PM
lukenccc Wrote:
Hi! it's an interesting topic. I would say you can use jQuery (or any other library) if it make development easier for you. 30kb is not a problem today, so if you are creating a web site or an application for you or for one of your clients, and jQuery helps you to save some development time... then feel free to take it.

In the other hand, if you are creating a library, which will be used by other developers (an npm package for example) to solve an specific problem and it has nothing to do with jQuery capabilities, then you should take a few minutes and think if you really need to add a dependency to your library, when you could just create a few utility functions and avoid jQuery. Adding dependencies to a library (which is designed to be a dependency for other projects) creates a chain of future probable unsolvable malfunctions. As an example, right now I'm working on a project. My application depends on an npm package called "send", which additionally depends on another package called "mime". Now, mime was recently found to have a high severity security vulnerability. That means my application has a security vulnerability too, and I didn't even know I was having mime as a dependency. Now, the people developing the package "send" can't do nothing and we have to wait until mime's new release date, to be "free" of their vulnerability.
So, as I said, if you are creating a library, try to remember that any package you use is a possible future bug you will not be able to fix.

So webpack recommends by default around 200kb for a built application. If including jQuery that's almost a quarter of the size. Along with this, as developers, we are responsible for not just building applications, but building fast and lightweight websites. Also the majority of people simply include jQuery because they know no different, I hope this thread sheds some light, and maybe helps push a few people into learning more about Javascript itself Smile.

You are of course entirely correct on the dependencies, might be worth a thread later.
,,`,,,,`, Software Engineer ,,`,,,,`,

Users browsing this thread: 4 Guest(s)