Anyone have a tool they like for bundle

Anyone have a tool they like for bundle size analysis?
13 Replies
Crisfole
CrisfoleOP3y ago
I've gotten close to the limit for my 1MB cap, but I can't find a good tool for helping me shrink that down... Or rather, finding where I could be shrinking it down. Is minifying my best bet? I'm hesitant to that from a debugability perspective...
Hello, I’m Allie!
In general, it is always best you minify your code. If you are using esbuild, you can have it generate a source map, which allows for better traces when debugging locally, and in general, that should be enough to debug, since you shouldn’t be manually reading and editing the minified code
Crisfole
CrisfoleOP3y ago
Right, I'm doing that, and minifying dropped the pre-gzip size to 600kB, I was really mostyl hoping to figure out where the large bits were that weren't getting tree shaken....
Crisfole
CrisfoleOP3y ago
One of my depednencies is turfjs (https://turfjs.org/) which is a beast, but I had assumed that since I imported specific modules only that most of it would get shaken....
Turf.js | Advanced Geospatial Analysis
Turf.js | Advanced geospatial analysis for browsers and Node.js
Hello, I’m Allie!
If you don’t minify your code and use esbuild, there should be comments in the final build highlighting where each block comes from, so you then can work out approximately where most of the bloat comes from
Crisfole
CrisfoleOP3y ago
Sure....
Crisfole
CrisfoleOP3y ago
Here we go, this is what I was looking for: https://esbuild.github.io/api/#metafile
Hello, I’m Allie!
TIL, thanks!
Crisfole
CrisfoleOP3y ago
Ergh, it's not working....wonder if it's CLI only, no js api...
Hello, I’m Allie!
It says it does support CLI, JS, and Go
Crisfole
CrisfoleOP3y ago
Never mind, I'm under caffeinated: it's in my top level directory.
Crisfole
CrisfoleOP3y ago
Found the issue
No description
Crisfole
CrisfoleOP3y ago
Wow. 1.1MB to .3MB with that tool. Found the culprit... Building this into the standard esbuild/miniflare/wrangler template would make a lot of sense to me...It's tricky because the building is so decoupled from the serving (which is Miniflare's main thing), and you wouldn't want to make it harder to use different tools...
Want results from more Discord servers?
Add your server