Hacker News new | ask | show | jobs
by scott_w 1152 days ago
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.

2 comments

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.