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