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. Hey would you mind letting me know which hosting company you’re using?
    I’ve loaded your blog in 3 different browsers and I must
    say this blog loads a lot quicker then most.

    Can you recommend a good hosting provider at a fair price?
    Thanks, I appreciate it!

  2. At this time it appears like BlogEngine is the best blogging platform out there right now.
    (from what I’ve read) Is that what you’re using
    on your blog?

  3. เปรียบเทียบระหว่างรุ่นเก่าและรุ่นใหม่ของแบรนด์นี้กันหน่อยดีกว่า #BT_PREMIUM## ไฟหน้า led

  4. 왜인지 모르겠지만 이 웹사이트가 제게 너무
    느리게 로드됩니다. 다른 사람이 이 이슈를 겪고 있나요,
    아니면 제 쪽 문제인가요? 나중에 다시 확인해서 문제가 여전히 있는지 볼게요.

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

  5. Hey there! This is my 1st comment here so I just wanted to give a quick shout out and say I truly enjoy reading your blog posts.
    Can you suggest any other blogs/websites/forums that deal with the same topics?
    Thank you!

  6. I enjoy, cause I found exactly what I used to be having a look for.
    You’ve ended my four day long hunt! God Bless you
    man. Have a great day. Bye

  7. Промокод при регистрации в 1xbet сегодня. Этой акцией может воспользоваться каждый новый игрок при регистрации на сайте букмекера. Это ваше преимущество с начала. В форме регистрации есть необязательное поле для ввода кода. Как получить promo code 1xBet на фрибет. В магазине xBonus можно обменять баллы на коды 1xbet kz: для ординаров экспрессов или лотерей. Найти промокоды 1xbet можно в интернете. Представители БК часто публикуют их к праздникам или турнирам. Все актуальные промокоды 2026 доступны в официальном разделе сайта и могут быть обменяны на бонусные баллы.