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,999 thoughts on “jQuery CDN as A Named Module In RequireJS

  1. What’s Happening i’m new to this, I stumbled upon this I have found It absolutely useful and it has helped me out loads.
    I hope to give a contribution & aid different customers like
    its helped me. Good job.

  2. Its like you learn my thoughts! You appear to grasp so much approximately this, such as you
    wrote the ebook in it or something. I feel
    that you could do with a few percent to pressure the message house a bit, but other than that, that is great blog.
    An excellent read. I will definitely be back.

  3. 88AA khẳng định vị thế bằng hệ thống pháp lý minh bạch và link truy cập chính thức an toàn. Trang chủ luôn được cập nhật mới, hạn chế tối đa tình trạng gián đoạn để hội viên yên tâm trải nghiệm.

    Với công nghệ bảo mật cao cùng kho trò
    chơi phong phú, tất cả đã tạo nên môi trường cá cược trực
    tuyến uy tín; đáp ứng mọi nhu cầu giải
    trí cho người tham gia. https://epsilon.eu.com/

  4. This piece of writing provides clear idea in favor of the new visitors of
    blogging, that actually how to do blogging and site-building.

  5. Hey there! This is kind of off topic but I need some guidance
    from an established blog. Is it hard to set up
    your own blog? I’m not very techincal but I can figure things out pretty quick.
    I’m thinking about making my own but I’m not sure where
    to start. Do you have any ideas or suggestions? Many thanks

  6. 이것은 말 그대로 휴대폰 소액결제 서비스를 통해 얻은 상품이나 상품권을 현금으로 바꾸는 것을 의미합니다.
    예를 들어 휴대폰 소액결제 한도로
    문화상품권, 구글 기프트

  7. Ahaa, its fastidious conversation on the topic of this article at this place at this webpage, I have read all
    that, so now me also commenting at this place.

  8. Thanks a lot for sharing this with all people you actually recognize what
    you’re talking approximately! Bookmarked. Kindly additionally discuss with my website =).
    We may have a hyperlink trade arrangement among us

  9. Great post. I was checking constantly this blog and I’m impressed!

    Extremely useful information specifically the last part :) I care for such information much.
    I was looking for this certain info for a long time. Thank you and good luck.

  10. Hello! I could have sworn I’ve been to this web site before but after looking at a few of the
    posts I realized it’s new to me. Anyhow, I’m certainly pleased I
    found it and I’ll be book-marking it and checking back often!

  11. Experience the best Nuru massage in Bangkok at HisoMassage.com your ultimate destination for authentic erotic massage, soapy massage,
    and happy ending massage on Sukhumvit. Our expert Nuru therapists
    provide a luxurious, sensual experience that defines true relaxation in the heart of Bangkok.

  12. You could certainly see your enthusiasm in the work you write.
    The world hopes for more passionate writers like you who aren’t afraid
    to mention how they believe. Always go after your heart.

  13. Howdy! I know this is sort of off-topic but I needed to ask.
    Does managing a well-established website such as yours take a
    large amount of work? I’m brand new to operating a blog however I do write in my diary
    daily. I’d like to start a blog so I will be able to share my own experience and feelings online.
    Please let me know if you have any recommendations or tips
    for new aspiring blog owners. Thankyou!

  14. Hello there, You have done an incredible job. I’ll definitely digg it and personally recommend to
    my friends. I’m sure they’ll be benefited from this site.

  15. دوستان، راجع به سایت‌های قمار آنلاین کاملاً محتاط باشید.
    چنین پلتفرم‌ها با آگهی‌ها فریبندهافراد را فریب می‌زنند، لیکن در باطن مملو دروغ
    است. ضرر پول صرفاً یکی از تهدیدها است؛ وابستگی عامل جدایی خانوادگی و افسردگی گسترده
    می‌شود. لطفاً به هیچ وجه مشغول نمی‌شوید!

  16. Hi there, You have done an excellent job. I’ll definitely digg it
    and personally recommend to my friends. I’m confident they’ll be benefited
    from this website.

  17. ufafat หรือ ยูฟ่าแฟด เว็บเดิมพันออนไลน์มาตรฐาน UFABET เล่นง่าย จ่ายจริง ระบบอัตโนมัติรวดเร็ว ครบทุกเกมดังในเว็บเดียว สมัครฟรีวันนี้!

  18. Howdy just wanted to give you a quick heads up.

    The text in your article seem to be running off the screen in Ie.
    I’m not sure if this is a format issue or something to do with browser compatibility but I thought I’d
    post to let you know. The style and design look great though!
    Hope you get the problem solved soon. Many thanks

  19. Do you mind if I quote a couplpe of your posts as long as I provide credit and sources back
    to your site? My website is in the exact same nicdhe as yours
    and my users would truly benefit from a lot of the information you present here.

    Please let me know if this alright with you. Thanks!
    프랑크푸르트 한인마트, Abbey,

  20. I’m really loving the theme/design of your weblog.
    Do you ever run into any web browser compatibility problems?
    A couple of my blog audience have complained about my
    site not working correctly in Explorer but looks great in Safari.
    Do you have any suggestions to help fix this issue?

  21. I was recommended this web site by my cousin. I am not sure whether this post is written by him as nobody
    else know such detailed about my difficulty. You’re wonderful!
    Thanks!

  22. There’s certainly a lot to know about this issue.
    I love all the points you made.

  23. My partner and I absolutely love your blog and find nearly
    all of your post’s to be precisely what I’m looking for. Do
    you offer guest writers to write content available for you?

    I wouldn’t mind publishing a post or elaborating on many of the subjects
    you write regarding here. Again, awesome website!

  24. I’m really loving the theme/design of your website.
    Do you ever run into any web browser compatibility
    problems? A couple of my blog audience have complained about my site
    not working correctly in Explorer but looks great in Opera.
    Do you have any suggestions to help fix this issue?

  25. Your mode of telling all in this paragraph is actually fastidious, every one be able to
    effortlessly be aware of it, Thanks a lot.

  26. This is very interesting, You are a very skilled blogger.
    I have joined your rss feed and look forward to seeking more
    of your excellent post. Also, I’ve shared your web site in my social networks!

  27. کاربران گرامی، بهتر است پرهیز وب‌سایت‌های
    بازی شرطی بمانید. دوست من از انتظار سریع پولدار گردیدن
    وارد گردیدم، ولی تنها ناکامی مشاهده.

    این پلتفرم‌ها آکنده از تقلب همچنین
    سوءمصرف طراحی شده. خانواده افراد
    اهمیت خطر این امر رانمی‌گردد!

  28. What’s up friends, how is everything, and what you would
    like to say regarding this post, in my view its genuinely awesome in favor of me.

  29. I don’t even know how I ended up here, but I thought this
    post was great. I don’t know who you are but certainly you are going to a famous blogger
    if you aren’t already ;) Cheers!

  30. Excellent post but I was wondering if you could write a litte more on this topic?
    I’d be very thankful if you could elaborate a little bit further.
    Appreciate it!

  31. Discover Bangkok’s finest Nuru and erotic massage experience.
    Indulge in sensual VIP and soapy massages with a happy ending in a private, elegant
    spa. Real photos, real therapists, ultimate relaxation.

  32. I am regular reader, how are you everybody? This article posted at this website is in fact good.

  33. Very nice post. I just stumbled upon your blog and wished to
    say that I have truly enjoyed surfing around your weblog posts.
    In any case I’ll be subscribing to your feed
    and I’m hoping you write once more very soon!

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>