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

Every JS dependency injection framework that I've ever seen uses it.


Serious question: why use a dependency injection framework with JS?


Yes, and that's widely been regarded as a mistake.

Now that we have ES6 imports and wide CommonJS support I don't see any good reason to use hacky DI with Function#toString.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: