logoalt Hacker News

exabrialyesterday at 3:56 PM2 repliesview on HN

>For context, I consider 1 MB of Javascript to be on the heavy side for a web page/app.

I feel like > 2kb of Javascript is heavy. Literally not needed.


Replies

tracker1yesterday at 4:25 PM

While I tend to agree... I've been on enough relatively modern web apps that can hit 8mb pretty easily, usually because bundling and tree shaking are broken. You can save a lot by being judicious.

IMO, the worst offenders are when you bring in charting/graphing libraries into things when either you don't really need them, or otherwise not lazy loading where/when needed. If you're using something like React, then a little reading on SVG can do wonders without bloating an application. I've ripped multi-mb graphing libraries out to replace them with a couple components dynamically generating SVG for simple charting or overlays.

dmityesterday at 4:48 PM

Preact have been fairly faithful to being <10k (compressed)! (even though they haven't updated the original <3k claim since forever)