0

I am having a lot of trouble getting jQuery to load properly with require.js, despite seeing hundreds of examples and samples. You can actually read more about my frustrations in a completely different question, seen here ...

25126564

My question here is a bit related, but on the require.js website, there is a comment at the bottom of this page: Using requirejs with jQuery

Previously, we've been pointing to an example using a special require-jquery file, which consisted of require.js and jQuery concatenated. This is no longer the recommended way to use jQuery with require.js, but if you're looking for the (no longer maintained) example, you can find require-jquery here.

My major question is why is this not recommended anymore? I tried it out on my own and this has been the only way I have been able to reproduce consistent results of loading jquery alongside requirejs. Why was this method dropped? What is the 'correct' way of doing it? As you can see in my other question, I've got working code, but it only works literally half the time.

1 Answer 1

1

This is because:

  1. jQuery supports AMD out of the box: http://requirejs.org/docs/jquery.html#modulename

  2. More generally, libraries that are not AMD-ready can be turned into an AMD module by using the shim configuration, no need to wrap the original module or edit original library distribution.

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

Comments

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.