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. I do consider all of the ideas you have presented to
    your post. They’re very convincing and will definitely work.

    Nonetheless, the posts are too short for novices.
    May just you please extend them a little from subsequent time?
    Thank you for the post.

  2. Hello this is somewhat of off topic but I was wanting to know if blogs use WYSIWYG editors or
    if you have to manually code with HTML. I’m starting a blog soon but
    have no coding expertise so I wanted to get guidance from someone with
    experience. Any help would be enormously appreciated!

  3. Thanks a bunch for sharing this with all of us you really recognise what you are speaking approximately!
    Bookmarked. Kindly also discuss with my web site =). We can have a link
    alternate agreement between us

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

  5. Considering how crucial legal support is in such scenarios, linking up with reputable Motorcycle accident lawyer can truly make a difference in your personal injury case. Their expertise and guidance could pave the way for rightful compensation and justice!

  6. Exploring legal options with Seattle personal injury lawyers can bring the support you need during tough times. If you’re facing uncertainties, reaching out to professionals like those at Big rig accident lawyer is a step towards clarity and empowerment.