Hacker News new | ask | show | jobs
by groestl 1152 days ago
> tree-shaking

Always fascinated when I hear that JS term for what's essentially dead code elimination.

1 comments

As far as I understand it, that's because it's different. Dead code elimination analyses the code and removes paths that can't be executed.

Tree shaking only looks at the imports and removes code that isn't imported from the bundle. If code is imported but not executed, then tree shaking won't remove this code, even though it is dead code.

Using a different term is reasonable to avoid confusion, in this case.

Ah, wasn't aware of this, thanks for clarifying.
I also think terming something in JS culture is much more welcoming than the one that thinks dead code elimination is the way it should be.