2 ms·
> 1. Import React. This is the step you can do from a CDN instead of you want a faster initial page load. Using a CDN is very unlikely to get you a faster init
by chrismorgan 1y ago
> 1. Import React. This is the step you can do from a CDN instead of you want a faster initial page load.
Using a CDN is very unlikely to get you a faster initial page load. Initialising an HTTPS connection to a new host is almost always going to take longer than serving that file first-party; there’s even a decent chance of this if your server is on the other side of the world.
- kqr 1y agoThe problem in this case is not the HTTPS connection, but the fact that browsers, when importing ES6 modules, import all their transitive dependencies one by one. This means they can make a bazillion requests under the hood when importing just one library. A CDN is likely to have the library bundled and minified with its dependencies, turning those bazillion requests into a single one, which is much faster.
- chrismorgan 1y agoIn that case, if you’re actually talking about bundled versus many-files, please don’t say “CDN … if you want a faster initial page load”. Public CDNs made some sense as performance advice long ago, but now they never really do, but there are still many people who don’t realise it.
- kqr 1y agoYou're right. That was a bad choice of wording on my part. Thanks for clarifying!