jQuery CDN as A Named Module In RequireJS

If you want RequireJS to fetch jQuery from a CDN, you’ll need to tell it to do so using the “paths” config:

require.config({
paths: {
"jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"
}
});

As I understand it, if you want to use the local file fallback code a la html5bp you’re out of luck. For those of you who don’t know, the local file fallback code allows you to load jQuery from your own domain if the CDN version fails to load. It looks like this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.8.2.min.js"><\/script>')</script>

Arguably, if you’re using jQuery it is likely to be a global requirement rather than a requirement for one or two modules. The same sort of thing with BackboneJS. It might be better to place these global requirements in the HTML for your pages (before the RequireJS script) to save typing ‘jquery’ and ‘backbone’ in all your module definitions.

22,429 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. Hello i am kavin, its my first occasion to commenting anywhere,
    when i read this article i thought i could also create comment due to
    this sensible post.

  2. OMT’sgamified elements award development, mаking
    mathematics thrilling аnd motivating trainees t᧐ intend for
    test proficiency.

    Expand your horizons with OMT’s upcoming brand-new physical area opening
    in Septembеr 2025, offering a ⅼot more chances for hands-onmath expedition.

    Offered tһаt mathematics plays а pivotal function in Singapore’s economic advancement ɑnd
    progress, investing іn specialized math tuition equips trainees ѡith the problem-solving abilities neеded tߋ prosper іn a competitive landscape.

    Witһ PSLE math contributing considerably t᧐ t᧐tɑl ratings, tuition supplies
    additional resources ⅼike model answers f᧐r pattern recognition ɑnd algebraic thinking.

    Τhorough responses fгom tuition teachers οn practice attempts
    helps secondary students gain from mistakes, improving
    accuracy fօr the actual О Levels.

    For those going after H3 Mathematics, junior college tuition ᧐ffers innovative advice οn гesearch-level subjects t᧐
    stand oᥙt in thiѕ difficult expansion.

    Thе distinctivenedss ᧐f OMT originates fгom
    its proprietary math educational program that expands MOE content with project-based learning fօr ᥙseful application.

    OMT’s on-lіne math tuition ⅼets you revise аt your oԝn rate lah,
    ѕo no mօre hurrying and your math grades ѡill certainly shoot սp
    progressively.

    Singapore’ѕ incorporated math curriculum advantages fгom tuition tһat connects
    topics ɑcross levels for natural exam preparedness.

    Check οut my blog post: Kaizenare math tuition

  3. Having read this I believed it was rather enlightening. I appreciate you spending some time and effort to put this short article together.

    I once again find myself spending way too much time both reading and leaving comments.
    But so what, it was still worthwhile!

  4. Hey great blog! Does running a blog such as this require a
    great deal of work? I’ve very little knowledge of computer programming but I had been hoping to start my own blog soon. Anyway,
    if you have any ideas or techniques for new blog owners please
    share. I understand this is off topic however I simply needed to ask.
    Kudos!

  5. I’d like to thank you for the efforts you’ve put in penning this site.
    I really hope to view the same high-grade blog posts by you in the future as well.
    In fact, your creative writing abilities has motivated me to get my very own blog now
    ;)

  6. At this time I am going away to do my breakfast, when having my breakfast coming yet again to read further news.

  7. Howdy I am so thrilled I found your web site, I really found you by mistake, while I
    was looking on Bing for something else, Anyhow I am here now and would
    just like to say thanks a lot for a tremendous post and a all round interesting blog (I also love the theme/design), I don’t have
    time to read it all at the minute but I have book-marked it and also included your RSS feeds,
    so when I have time I will be back to read much more, Please do keep up the excellent job.

  8. My relatives all the time say that I am killing my time here at web, however I know I am getting knowledge every
    day by reading thes nice articles or reviews.

  9. Thanks for ones marvelous posting! I truly enjoyed reading it,
    you can be a great author.I will be sure to bookmark your blog and will come back later in life.
    I want to encourage one to continue your great writing, have a nice evening!