1

Is there a way to include jQuery and jQuery UI in my react app that is embedded in 3rd party websites without polluting the unsuspecting host site with those libraries?

Update. Comments asked for reasons.

I need Draggable, resizeable, Rotatable features. There is a react-resizable-rotatable-draggable library, which is no longer supported and seems hard to style. I'm converting an existing app that uses Jquery UI so exploring that option makes sense.

3
  • No. See the many questions pertaining to loading multiple versions of jQuery. Commented Feb 22, 2021 at 16:41
  • You might ask yourself why you're using either library. jQueryUI has been out of development for half a decade, having been replaced by many more modern tools, and jQuery itself just isn't very relevant or necessary anymore. Commented Feb 22, 2021 at 16:43
  • 1
    Because I need draggable, rotateable, resizeable and the react module for that seems abandoned. Also, i'm converting an app that used jquery ui, so its my first stop. Commented Feb 22, 2021 at 17:31

1 Answer 1

1

If you use a bundler like Webpack or Parcel to package your code, there should be no issues in terms of "polluting" the global namespace or causing version conflicts with jQuery.

The bundlers provide tree-shaking, which should reduce the amount of jQuery code that is added, though how much unused code would be eliminated is anyone's guess, and depends on your usage.

Sign up to request clarification or add additional context in comments.

10 Comments

Great! i'm using webpack as it comes with github.com/facebook/create-react-app
@Will great, you should be all set, then!
thanks, but I have follow up question? stackoverflow.com/questions/66338190/…
@Will looks like you figured it out already!
Unfortunatly, it seems like our code is polluting the site version of jQuery. Results in errors like TypeError: $(...).imagesLoaded is not a function. Any ideas why or how to debug? @Codebling ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.