Hacker News new | ask | show | jobs
by untog 4640 days ago
I think the benefits of this approach are outweighed by the number of HTTP requests you have to send for individual JS files. In the majority of cases you'll find that all of your JS, bundled up and minified, loads faster than getting each file as it is required.
2 comments

Yeah, there is a bit of an overhead with that. Module server - https://github.com/google/module-server seems like quite a good solution. Though I'd agree, for a large number of sites it's far better to bundle them up.
For a large scale website, where not every page would have a video player, gallery, or calendar, why load that JS and CSS, which can be very heavy. The benefits are definitely there without having to declare explicitly that a particular page needs a certain dependency.