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.

6,865 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. It’s remarkable to visit this web page and reading the views of all friends about this post,
    while I am also zealous of getting knowledge.

  2. I really love your blog.. Very nice colors & theme.
    Did you create this site yourself? Please reply back
    as I’m wanting to create my very own website and would like to learn where you got this from or
    just what the theme is called. Thanks!

  3. Greetings! This is my first visit to your blog! We are a group of volunteers and starting a
    new project in a community in the same niche. Your blog provided us beneficial information to work on. You have done a outstanding job!

  4. Hello everyone, it’s my first visit at this web page, and piece of writing is in fact fruitful for me, keep
    up posting these types of articles or reviews.

  5. I do accept as true with all the ideas you have introduced in your post.
    They are really convincing and can certainly work.
    Still, the posts are too short for beginners. May just you please lengthen them a
    little from next time? Thank you for the post.

  6. Hi, the whole thing is going perfectly here and ofcourse every one is
    sharing facts, that’s actually fine, keep up writing.

  7. I’m really enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more
    enjoyable for me to come here and visit more often. Did you hire out a designer
    to create your theme? Superb work!

  8. Admiring the time and energy you put into your blog and
    detailed information you present. It’s nice to come across a blog every once in a while that isn’t the same out of date rehashed
    material. Excellent read! I’ve saved your site and I’m
    including your RSS feeds to my Google account.

  9. Howdy! I’m at work browsing your blog from my new iphone 4!
    Just wanted to say I love reading through your blog and look forward to
    all your posts! Carry on the great work!

  10. This is the perfect website for everyone who wishes to understand this topic.
    You know so much its almost hard to argue with you (not
    that I really would want to…HaHa). You definitely put
    a new spin on a subject that’s been written about for a long time.
    Wonderful stuff, just great!

  11. Greetings! This is my first visit to your blog! We are a collection of
    volunteers and starting a new initiative in a community in the same
    niche. Your blog provided us valuable information to
    work on. You have done a outstanding job!

  12. I pay a visit daily a few web pages and blogs to read articles or reviews, however this weblog offers feature based writing.

  13. Bermain slot di TESLATOTO situs dengan RTP transparan yang memudahkan strategi cerdas.
    Coba game terbaru 2025 dengan volatilitas tinggi, peluang menang lebih besar, serta pengalaman bermain yang lebih profesional.
    Pas untuk pemain cerdas yang bermain dengan strategi,
    bukan sekadar memutar spin secara acak.

  14. Oh my goodness! Impressive article dude!
    Thank you so much, However I am going through issues with your RSS.
    I don’t know the reason why I am unable to subscribe to it.
    Is there anyone else getting the same RSS issues? Anyone that knows the solution will you kindly respond?

    Thanks!!

  15. Finding professional software that stabilizes quality and expense can be tough. For engineers, designers, and architects, investing in cheap CAD software that still offers trusted performance is critical. With various choices readily available, it is necessary to assess performance, use, and support before devoting to an acquisition. Picking the ideal affordable CAD software can improve your workflow, enhance productivity, and provide the tools you need to create precise, expert designs without spending too much. Platforms like ProSoftStore make it less complicated to gain access to affordable CAD software with complete attributes, giving professionals the adaptability to focus on their jobs confidently, https://www.tumblr.com/clairepeterson5581/795368126836572160/how-to-compare-features-of-cheap-cad-software?source=share.

  16. Wonderful beat ! I would like to apprentice even as
    you amend your web site, how can i subscribe for a weblog website?
    The account helped me a acceptable deal. I had been tiny bit familiar of this your broadcast provided shiny clear idea

  17. Hi! I’ve been following your site for a while now and finally got the courage to go
    ahead and give you a shout out from Huffman Texas! Just wanted to
    tell you keep up the excellent job!

  18. Way cool! Some extremely valid points! I appreciate you penning
    this article plus the rest of the site is very good.

  19. Hey! I just wanted to ask if you ever have any problems
    with hackers? My last blog (wordpress) was hacked and
    I ended up losing many months of hard work due to no back
    up. Do you have any methods to stop hackers?

  20. Howdy exceptional blog! Does running a blog like this take a great deal of
    work? I have absolutely no expertise in programming
    but I had been hoping to start my own blog in the near future.

    Anyways, if you have any suggestions or tips for new blog owners please share.
    I know this is off topic however I simply wanted to ask.
    Thanks!

  21. What’s Taking place i’m new to this, I stumbled upon this
    I have discovered It positively useful and it has helped me out loads.
    I hope to give a contribution & help different customers like its aided me.
    Good job.

  22. When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get
    several emails with the same comment. Is there
    any way you can remove people from that service?
    Thank you!

  23. Hey there just wanted to give you a quick heads up.
    The words in your article seem to be running off the screen in Ie.
    I’m not sure if this is a formatting issue or something to do with web browser compatibility but I figured I’d post to let
    you know. The style and design look great though!
    Hope you get the problem solved soon. Many thanks

  24. Hi there just wanted to give you a brief heads up and let you know a few
    of the images aren’t loading correctly. I’m not sure why but I think
    its a linking issue. I’ve tried it in two different browsers and
    both show the same results.

  25. Just wish to say your article is as amazing.
    The clarity in your post is simply great and that i can think
    you’re an expert on this subject. Fine together with your permission let me to
    snatch your RSS feed to stay updated with imminent post.
    Thank you 1,000,000 and please continue the gratifying work.

  26. Heya i’m for the first time here. I came across
    this board and I find It truly useful & it helped me out a lot.
    I am hoping to provide something back and help others such as you helped me.

  27. Hi, i read your blog from time to time and i own a similar one and
    i was just curious if you get a lot of spam feedback?
    If so how do you prevent it, any plugin or anything you can recommend?
    I get so much lately it’s driving me insane so any support is
    very much appreciated.

  28. Have you ever considered about including a little bit more than just your articles?
    I mean, what you say is important and all. Nevertheless imagine if you added some great visuals
    or video clips to give your posts more, “pop”!

    Your content is excellent but with pics and video clips, this website could certainly be one
    of the greatest in its niche. Fantastic blog!

  29. I think this is one of the most significant info for me.
    And i am glad reading your article. But wanna remark on few general things, The website style is
    perfect, the articles is really excellent : D. Good
    job, cheers

  30. I really like your blog.. very nice colors & theme.

    Did you design this website yourself or did you hire someone to do it for you?

    Plz reply as I’m looking to construct my own blog and would
    like to know where u got this from. kudos

  31. Really no matter if someone doesn’t understand afterward
    its up to other viewers that they will assist, so here it occurs.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>