Hacker News new | past | comments | ask | show | jobs | submit login

> In a limited way due to side effects from the require function.

In a limited way that covers something like 99.9% of CJS usage. Bundling is based on static analysis.

If by side effects you mean running code, not just declaring exports, ES6 import does these side effects too.

Thinking that CJS can't be used for static analysis or tree-shaking is the widest spread pure ignorance.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: