In order to improve performance of our web pages, we are recommended to use CDNs to serve .js
files on our web pages. That makes sense.
Also, we are recommended to bundle our .js
files in order to reduce the number of requests which are being made to server on load.
So, we need to sit down and make decision between if we use CDN or bundle .js
files.
What are the pros and cons? Which ones make more sense?
Why can't you bundle them and place them are the CDN? It should hardly be a decision of one or the other?
If you have to choose one or the other, it depends on how many .js
files you are including. For a small number of files, I'd suggest that a CDN would be quicker, where-as for a greater number of files, a bundle of .js
files would definitely be quicker. Where the switch-over would be, is something for you to experiment with.