5 ms·
You pretty much will always need a bundler, unless you write everything from scratch, and don't support legacy browsers. Webpack actually does do things like co
by simonlc 9y ago
You pretty much will always need a bundler, unless you write everything from scratch, and don't support legacy browsers. Webpack actually does do things like code splitting for you, so no, not everything goes into one file.
- RobertRoberts 9y agoCan you explain if Webpack would help with Wordpress sites? Or is Webpack really only for webapps? What is the benefit gained from "code splitting"? Would it make a blog run faster? What if the largest amount of JS on your site is 5k? Why would there be a need to code split this?
- slig 9y agoI'm not the parent, but you don't need webpack for something like a WP blog. Code splitting is great on bigger webapps such as GMail or Facebook. For instance, when you want to see your contacts on gmail, it can load the required JS file of that module on demand. Same thing on FB: the chat widget can be loaded separately, and only if needed.
- RobertRoberts 9y agoThank you, this explains some basic things that seem to be assumed by so many web devs/blogs/etc... :P A while back I went through the process of evaluating a lot of build tools, and I simply couldn't see any benefits of replacing my bash scripts with these tools, and you cleared it up nicely.
- WorldMaker 9y agoWebpack could help with Wordpress sites. Whether or not it is worth the effort is another question. Most WP sites might not benefit from the effort. Also, yes, HTTP2 throws in additional considerations, though the surprise for me is that I've found even with direct filesystem access like in an Electron app, with no "connection overhead" like HTTP1.1, webpack bundles can be quite effective for performance gains. Especially with modern ES Modules, it can still be extremely effective to load a sequence of larger tree-shaken JS file all at once than a large number of tiny files.