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

Using npm's built in support for package aliases to simultaneously install zod@3 as zod and zod@4 as zod-next?

Edit: reading the rationale, it's about peer dependencies rather than direct dependencies. I am still a little confused.



As you allude to: your aliased "zod-next" dependency wouldn't be able to satisfy the requirements of any packages with a peer dep on Zod. But this approach has a more fundamental flaw. My goal is to let ecosystem libraries support Zod 3 and Zod 4 simultaneously. There's no reliable way to do that if they aren't in the same package.[0]

[0] https://github.com/colinhacks/zod/issues/4371




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: