It might be super bad from other point of views like latency, but it is certainly worth a consideration. ”. Getting this wrong is really bad because one static import, when it should have been dynamic suddenly may put stuff into the same bundle that shouldn’t be. So, you’re saying “Some users only use this part of my app, some users use another part”, and so you put together bundles that only get downloaded when the part of an application that a user is actually dealing with is executed. And the other important part of that job is that I make the junior engineers eventually be senior engineers. But at least the people that you are having empathy with, they are also other software engineers. Luckily this is empathy on easy mode. Empathy is generally hard, and this is still very hard. I would call this an application of empathy.
But having npm at your fingertips, this vast collection of modules, having that around absolutely changes how you write software. Obviously there is about 1000s more of these specialized modules, and it infeasible to put them all in one bundle, because that bundle would be a few megabytes in size, and users would become really unhappy. And whenever the user goes to a route, the router loads the associated bundle, and then within that route you can forget about code splitting existing. You just make each route one bundle, and your router in your application now understands there is code splitting. But I think the most popular way of doing code splitting is with webpack. That is the normal way of doing it in ES6 modules. But if you want to lazy load it, you get code like this where you use dynamic import, which is a new fancy thing to lazy load ES6 modules and you wrap it in a loadable component. Route based code splitting was nice, because you split your app at the coarsest level, and everything further down could ignore it.
Press it and hold it down for 10 to 15 seconds till the power light starts flashing. It starts up, and then it is stable, you can reason about it, you don’t have to wait for stuff. And so while they might be very different from you, they at least have in common that they are building software. I prefer to trust on a well maintained and open-source software project like OpenWRT. But then you’re like “Ah, 60KB for a bit of virtual DOM munging, let’s switch to Preact”-that is an API compatible library, it is not going to change how people write software, just because you make that choice. Let’s make that a bit more concrete. So, at Google we decided it is a nice idea, but we make it illegal, nobody gets to use it-with one exception: generated code. So, we can’t just use route based code splitting, we have to come up with a different way of doing it. The way I would talk about myself as a senior engineer is that I’d say “I know how I would solve the problem” and because I know how I would solve it I could also teach someone else to do it.