And it's not really "living is the leading cause of death"; most of that JavaScript is superfluous garbage - ad scripts, trackers, bloated frameworks. You don't need this for a page to serve a socially useful purpose. You just need someone in your company with enough clout, who's willing to say, "out of respect for our users and for engineering as a practice, we will not partake in the latest iteration of the insanity that is the modern web".
You don't need JS to "serve a socially useful purpose" most of the time, as well.
As I said, it seems we decided that everything needs to feel like an app.
95%(yes, I'm probably exaggerating) of the actual value of the today's websites could be plain documents with links to each other.
But try and suggest to anyone you're gonna have a company presence site(or anything for that matter) with no JS at all, and see where it gets you.
But my comment applies to apps as well - just because you need to write actual software, doesn't mean you should throw away sensible engineering, and produce a bloated, user-hostile, spying & battery-devouring monster. Yet this is what seems to be coming out of most web shops these days.
Now convince the client that they don't need to track every single possible click of the user - as they experience their "journey" through the site...
...convince the client that all those experience designers effusing about that "emotional layer" they added to that user journey didn't really result in 30% more engagement with the brand - as evidenced by exactly that same user tracking - convince em XD isn't just mouthing a load of horse shit. I mean - why do all the folks in XD dress in black all the time anyway. Would someone run a focus group on that please?
Funny thing is - I don't even know if they are all full of shit or not. Maybe all this is all necessary - maybe not. I don't even know and I build this stuff for a living. Client seems happy so meh...
But yeah - these large JS bundles aint the cause of these large JS bundles... ahem - I mean these slow sites...
In the post Flash days I was accepting of pushing JS use as far as possible but the fragmentation and complexity that seems to just have become implicitly accepted is just something I'm much happier looking at from a distance than wanting to ever get involved in again.
The fact that it's more difficult setting up a JS project than it is for, say, Scala which is itself a pain in the ass speaks volumes.
JS allows various levels of complexity. From inlining JS inside script tags in an html file or requiring a js file in the script tag to transpiling cutting-edge JS (or dialects/supersets of JS) with sourcemaps, minification, code-splitting, etc.
The latter end of the spectrum is reasonably complex; the former is ridiculously simple. I wonder if same can be said about Scala.
EDIT: As I wrote this comment the title here was edited to directly reflect the nature of my comment.
For 99% of the web a markup language with triggers and async loading could have been enough to implement menus, upvote posts, post login forms, and so on.
The mainstream libraries are fast and optimizable (Angular/React/Vue/etc). Other, not so much.
This is a very weak argument.
* many 3rd party resources are not cacheable or may have bad policies
* caches may be more often cold then you expect. most apps still cache large combined blobs, which will invalidate with each release.
* pure JS size has still it's impact on performance
* caching won't magically cut all network roundtrips which you need due to architectural reasonsAnd it is: "still its impact"
That sounds like saying "living is the leading cause of death".
I mean, I don't particularly like JS, but it seems like we decided long ago that plain documents and links won't cut it. Everything, apparently, needs to be a rich web application with huge images and a gazillion of ads.
Why is that Javascript's fault?