Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load jquery from CDN with fallback on optimized requireJS

I want to load jquery from a CDN with a local fallback.

That's pretty straightforward if you look it up in stackoverflow, i found this informative question about the task.

But when I am optimizing the code for production, jQuery gets bundled inside the optimized code, which kind of defeats the purpose of loading jQuery via a public CDN.

What are the solutions for this problem?

like image 542
thanpolas Avatar asked Mar 24 '26 03:03

thanpolas


1 Answers

One way might be to exclude it from your build. Use the config option exclude

https://github.com/jrburke/r.js/blob/master/build/example.build.js#L352

like image 165
Simon Smith Avatar answered Mar 25 '26 21:03

Simon Smith