Hacker News new | past | comments | ask | show | jobs | submit login

Webpack's chunking (https://github.com/webpack/docs/wiki/optimization#multi-page...) will help you get the "hybrid" approach easily. It lets you separate out common modules into JS files for you to load when needed.



That's what came to mind reading this. Why a whole post on this when you can literally just go look at the webpack docs and do this in 5 seconds.


I love webpack and highly recommend it, but it is not trivial to integrate it into an existing project and pretty much nothing about webpack can be described as "done in 5 seconds".


I did it in a big project it took a couple days, really wasn't that big a deal, and legacy JavaScript still goes through webpack and works unmodified, then a couple weeks to iron out any kinks in the CI scripts (but was still developing during this time)


A couple days sounds about right and jives with my own experiences, but I feel like "do this in 5 seconds" is pretty misleading, especially for someone who may have never used webpack before. It's absolutely worth the effort, but I wouldn't want someone to be discouraged had they expected a "5 second" solution but then realized it's not quite that simple.


This is typical programmer attitude. Standard estimates go like this:

When trying to make themselves look good on online developer forums: 1/100th real development time

When estimating time involved for co-worker: 1/10th real development time

When estimating time involved for themselves at work: 1/2 real development time


Webpack's algorithm for doing this is not black magic -- it has to consciously consider the same tradeoffs as were involved in this post. How many chunks should you have?




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: