Skip to content

Comment on Tiny Treeshaker: JavaScript tree shaking in 200 lines of codeparent

Comments

Something that drives me bonkers about current tree shaking is that there’s no good way to see what got shaken.

On a super basic level you can just build with and without tree-shaking and diff the results. If you turn off transpiling and minification, and move your bundled NPM modules to their own separate file, you can see what parts of your own code got shaken out pretty easily.

I'm tempted to have a go at writing a tool to do that actually. It would be useful.

diffs (and network graphs) seem like a great idea, but they quickly get so big that one can't make heads or tails of the visualization.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.