Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: