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. You can definitely see your expertise in the
    article you write. The sector hopes for more
    passionate writers like you who are not afraid to say how they believe.
    At all times follow your heart.

  2. Pretty component of content. I simply stumbled upon your site and in accession capital
    to claim that I acquire actually loved account your blog posts.

    Any way I will be subscribing on your augment and
    even I fulfillment you get admission to consistently quickly.

  3. Hey I know this is off topic but I was wondering if you knew of any widgets I
    could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was
    hoping maybe you would have some experience with something
    like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to
    your new updates.

  4. FC88 – Trang Chủ FC88.COM link đăng ký không bị chặn mới nhất 10/2025
    FC88 – sân chơi đổi thưởng trực tuyến đỉnh cao, mang đến trải nghiệm giải trí tuyệt vời với kho game đa
    dạng, giao diện thân thiện và bảo mật tối
    ưu. Sở hữ giấy phép hợp pháp PAGCOR tham gia ngay để khám phá
    các trò chơi hấp dẫn như Tiến Lên, Poker, nổ hũ,
    cùng cơ hội nhận thưởng lớn. Nhà cái hứa hẹn sẽ là điểm
    đến lý tưởng cho mọi game thủ Việt Nam trong năm
    2025. https://answer.us.org/

  5. Excellent post. I was checking constantly this weblog and I am inspired!
    Extremely useful info specially the last section :) I
    deal with such information a lot. I used to be seeking this certain information for a very long time.

    Thank you and best of luck.

  6. Way cool! Some very valid points! I appreciate you penning this post plus the rest of the site is also very good.