The answer I always assumed for this question is that common dependencies should be loaded via a CDN. This way common JS libraries are cached in the browser and loading become faster. However, many libraries online, e.g. React and Angular, and many packing system, e.g. Webpack and SystemJS, seems to be geared toward packing the JS dependencies in node_modules folder in the same bundle, so your website in production ends up loading one single bundle containing everything.
So my question is, what is the preferred way for loading dependencies? Bundling in the same JS file? Or via a CDN?
There are some arguments:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With