Re:The Controversial State of JavaScript Tooling
by SapphireSun on Tuesday February 02, 2016 @02:12PM
(#11021667)
I've also encountered problems with China blocking jQuery or fonts from Google.
Re:The Controversial State of JavaScript Tooling
by Grue3 on Wednesday February 03, 2016 @08:35AM
(#11026339)
This is solvable by also hosting a local copy and load it if CDN is not available. Example (from my website):
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/js/vendor/jquery-1.10.2.min.js"><\/script>')</script>
Re:The Controversial State of JavaScript Tooling
by mateo411 on Tuesday February 02, 2016 @06:26PM
(#11023553)
It's possible to not use the CDN when you are developing in your local environment, and use the CDN in your production environment. That way you can keep developing even when you are on an airplane.
Re:The Controversial State of JavaScript Tooling
by edejong on Tuesday February 02, 2016 @06:40PM
(#11023625)
Plus the cost of parsing the JSON and merging the huge object structures these libraries provide.
I missed one item on your list, which is security. Google does not provide any guarantees on the safety of the CDN provider versions of JQuery. Imagine the mayhem when a widely used jquery library is replaced by a backdoored version.
- Delay for DNS resolution and the new TCP connection could be non-trivial (some tests show 300ms+).
- A JS CDN is also likely tracking your traffic and you may not want them to.
- No offline dev environment (on the plane).
- Server run (phantom etc.) tests might run super slow if they have to pull in a remote js library.
- Probably issues when it comes to apps that are meant to work offline, although I think this is solved with service workers proxying the CDN request.
And if the recommendation is to continue loading large libraries from a CDN and nevermind only what you need, well there's still a memory cost. If I have 5+ SPAs running in tabs that are each fairly complex (you know, like Gmail), it does start to add up. Because of the way that tabs are sandboxed I believe this may mean 5 copies of jQuery or React or Angular or w/e.