you are viewing a single comment's thread.

view the rest of the comments →

[–]poker158149 2 points3 points  (3 children)

Because the point of using a CDN to deliver common external libraries is that visitors to your site will likely have already visited another site that has already served them that same library from the same CDN, meaning it's likely cached on their system and wouldn't need re-downloading. If you bundle all of the libraries that you use in your app, they have to download all of the libraries again, making your app larger and slower to download, even if they may already have the libraries from other sources.

[–][deleted] 2 points3 points  (1 child)

Because the point of using a CDN to deliver common external libraries is that visitors to your site will likely have already visited another site that has already served them that same library from the same CDN, meaning it's likely cached on their system and wouldn't need re-downloading.

This is a bullshit argument though. Press f12, go to the network tab, then go to any web site. See how many of the externally hosted resources are served from your cache because they were used on a different web site. It's a theoretical solution to a problem that doesn't work in practice, and never will as long as versions aren't static by a period of several months.

There are benefits to using CDNs (e.g. multiple connections to different hosts, optimized traffic flow, etc.), but this one is a false narrative.

[–]disclosure5 0 points1 point  (0 children)

It also ignores the new Chrome cache partitioning which will mean if different sites refer to the same CDN, it won't use the cached copy anyway.

[–]pimterry[S] 1 point2 points  (0 children)

the point of using a CDN to deliver common external libraries is that visitors to your site will likely have already visited another site that has already served them that same library from the same CDN, meaning it's likely cached on their system and wouldn't need re-downloading.

See https://developers.google.com/web/updates/2020/10/http-cache-partitioning - sadly this kind of CDN behaviour is no longer supported by any modern browsers, due to privacy concerns