3 ms·
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
by esperent 5y ago
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 https://en.m.wikipedia.org/wiki/Tree_shaking
- markl42 5y agoMight 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
- shwestrick 5y ago"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.