privatenumber / pkgroll

📦 Zero-config package bundler for Node.js + TypeScript
MIT License
1.01k stars 23 forks source link

Include package sizes of final bundle #12

Open ayuhito opened 2 years ago

ayuhito commented 2 years ago

Similar to other bundlers:

image
privatenumber commented 2 years ago

I contemplated this at one point, but I usually want to know the size of the entire package (not just the distribution files) so I run npx pkg-size to check.

I guess I wouldn't mind supporting this though!

ayuhito commented 2 years ago

Food for thought, but I think one really interesting metric would be measuring individual exports so you can get it's tree-shakened size.

I don't think that's an easy thing to do though compared to just providing the size of the output files.

Either way, even integrating pkg-size to reduce the number of input commands would be ideal per build.

privatenumber commented 2 years ago

Yeah that would be cool but probably a cherry on top. I actually wanted to write a module that helps calculate that.

We probably shouldn't integrate pkg-size to a bundler, because pkg-size is concerned about the entire package size (including README, LICENSE, package.json, etc) whereas the bundler is only concerned about the files it produced.

ayuhito commented 1 year ago

Just for future reference, but I think this project does implement all the treeshaking logic discussed before using esbuild and could be a useful baseline: https://github.com/okikio/bundle