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

I think the article is over-simplifying, I believe most tree-shaking is done at the `import`/`export` boundaries.

Code that isn't used locally in a module and is not imported by any other modules is omitted.

---

It helps that there isn't a global object for the local module scope, otherwise in-module dead code detection would also not be possible, since any line of code within it could use dynamic access and static analysis wouldn't be able to prove that it isn't used.



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

Search: