That’s a strawman. I don’t need 1000s of lines of JS to swap a UI. I can do it in 1 line with Web Components: oldElement.replaceWith(newElement)
. And those modules can be lazy loaded like anything else.
This is just DX in name of UX, which is almost never a good idea.
And maybe you’re fine with throwing a server computation for every single UI change, but I’m not made of money and I much rather have stuff on a CDN.
I think i missunderstood you I thought you were arguing for modern web frameworks. Nothing wrong with replacing elments with js and not sending it as a request to a server I would do the same for stuff that doesn’t need data from the server. If you are really worried about latency you could throw your code in a cloudflare worker but I don’t think it matters that much average loading time of websites on desktop is 2.5 seconds . So it doesn’t really matter if the server is on the other site of the world latency will not be the biggest factor.