3 ms·
That never really works out in practice when there's so many versions and then you're at the disposal of a public CDN, which can be the bottleneck, especially w
by s_y_n_t_a_x 8y ago
That never really works out in practice when there's so many versions and then you're at the disposal of a public CDN, which can be the bottleneck, especially when it's critical code.
Sure you can fallback to local copies, but that just means your app hung there for X amount of time, and the added complexity of adding fallback logic.
Plus if you look at the size of these libraries, especially utility libraries (date-fns, underscore, etc) they are huge, and you usually only need a few functions. Relying on cache will never be a bigger benefit than tree-shaking.
Sure you could manually try to extract those functions, but that's a much much worse developer experience.
- rhizome 8y agoThat never really works out in practice So glad this was such dominant practice and advice for the last 10 years. I wonder for how many of those influential practictioners have known it's more of a lazy include than clever cache reuse. Cargo culting writ larger than most.
- omnimus 8y agoIt really depends. I think CDNs are still great if you are making smaller content website with few libs for things like lightboxes, sliders etc. It works out better than bundling. There is much less complexity without build process. Many websites don't need too much JS and devs tend to overengineer them nowdays. If you are talking about products with lot of dependencies then of course but don't forget that bundler situation used to be completely different. There is not that much of difference (besides number of requests) between concating libs in sequence and loading libs in sequence.
- rhizome 8y agoI'm speaking to the jquery example. 99% of howtos have instructed people to pull from CDN because everybody (probably) already has it. It has been conventional wisdom for a long, long time. I just checked, and googling "jquery cdn faster" brings up plenty of examples.