News for hackers. Stuff that matters.
Re:Tiny Treeshaker: JavaScript tree shaking in 200 lines of ... by esperent on Tuesday June 29, 2021 @04:07AM (#27673164)
I suspect (although I haven't checked the code) that this is actually a "dead code elimination" algorithm which is easier to write than a tree shaking algorithm.

Tree-shaking is actually "live code inclusion", the opposite side of dead code elimination.

https://en.m.wikipedia.org/wiki/Tree_shaking

Re:Tiny Treeshaker: JavaScript tree shaking in 200 lines of ... by shwestrick on Tuesday June 29, 2021 @09:42AM (#27675635)
"opposite" is not the right term... tree-shaking appears to be a particular technique for dead code elimination.

I.e., there are many algorithms you could use to eliminate dead code, and tree-shaking seems to just be a simple one that works well for JS.

Re:Tiny Treeshaker: JavaScript tree shaking in 200 lines of ... by markl42 on Tuesday June 29, 2021 @04:36AM (#27673340)
Might be worth checking the code but

> tree shaking eliminates unused functions from across the bundle by starting at the entry point and only including functions that may be executed

Is what this code (tries to!) do