News for hackers. Stuff that matters.
Re:Tiny Treeshaker: JavaScript tree shaking in 200 lines of ... by Kiro on Tuesday June 29, 2021 @07:26AM (#27674353)
I really don't understand the difference. Please enlighten me.
Re:Tiny Treeshaker: JavaScript tree shaking in 200 lines of ... by bschlenk1 on Tuesday June 29, 2021 @09:02AM (#27675193)
All tree shaking is dead code elimination, but not all dead code elimination is tree shaking (in webpack at least).

Tree shaking happens at the import level. If I say `import { abc } from 'some-lib'`, tree shaking won’t include any other objects some-lib may export.

Removing a branch that can never be true, like `if ('production' === 'production') { … } else { /* dead code */ }` is dead code elimination, but webpack wouldn’t consider that tree shaking.