Do I need jQuery when using React?

Sorry for opening up this old thread, but as I’m knee deep in transforming to a React setup (oh man, the amount of rewrites is crazy :)). So I figured just as the OP, that I could remove jQuery as well, I want to have a as clean setup as I can get.

No matter what I try, I can’t seem to get rid of jQuery in “development” mode. It is always loaded to the client. Is this because of some weak dependencies to it somewhere? e.g. the earlier mentioned “webapp”. Will that mean it will only get loaded in development mode and not in production?

I’ve echo’d the dependencies list using the bash command above, no mention of jQuery anywhere. Only weak references to “templating” and “webapp”.

edit: I’ve just tested the production build. jQuery 1.11.2 is still loaded there on the client :frowning:

1 Like

I’m with you on that as well.

jQuery is not needed. It is already installed in Meteor as default. Are you planning to install jQuery via NPM?

I think you’re misunderstanding us. We don’t want jQuery. It adds to build times and network load.

4 Likes

I just installed a chrome extension (wappalyzer) that analyses websites and reports on the technologies used to build them. Even though I removed jQuery from Meteor packages, it’s still detecting jQuery as a site dependency. Can it be removed from Meteor altogether?

Yes, we have removed jQuery completely from the client bundle. You need to track down all your NPM and Meteor package dependencies to make sure nothing is pulling it in.

Thank you for the reply. Any tips on tracking down indirect dependencies?

Edit: I’m familiar with npm list and meteor show.

Takes some brute force. Look through the package.js source file for all the Meteor packages you are including for the Package.onUse section for any api.use('jquery', 'client'); calls (also without the client option). Also, check for other dependencies that have known jquery client dependencies like accounts-ui-unstyled. You have to check any and all “suspect” packages and their full dependency chains. Make sure any NPM packages you are including are also not bringing in jQuery. Like I said, brute force.

We don’t use many Meteor or 3rd party Atmosphere packages so it was not that difficult to remove jQuery from the client for us. You are still going to have jQuery in you server bundle as there is a dependency on the server from boilerplate-generator as it has a dependency on spacebars, which eventually pulls in jQuery. I think there is an open Github issue on this and probably someone could remove this server dependency without much effort, but we don’t have the time or the desire. Good luck!