zod: Zod v3.20.2 causing stalled build in CRA project
Started using Zod in a create-react-app project in combination with react-hook-form. Everything works fine except building the project.
No error is thrown, the build simply freezes and is stalled. When running npm run build --verbose it just pretty much stops completely after the first initial logs that happen within approx. 20ms.
It seems to be a problem with the, at this time, latest version v3.20.2. After downgrading Zod to v3.19.1, it builds normally.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 15 (1 by maintainers)
Commits related to this issue
- fix(app): update all non-major dependencies (#270) [](https://renovatebot.com) This PR contains the following updates: | Package | Cha... — committed to weareinreach/InReach by kodiakhq[bot] a year ago
- fix(deps): update dependency zod to ^3.21.0 (#111) [](https://renovatebot.com) This PR contains the following updates: | Package | Cha... — committed to fiatconnect/api-starter by renovate[bot] a year ago
- fix(deps): update dependency zod to ^3.21.0 (#135) [](https://renovatebot.com) This PR contains the following updates: | Package | Cha... — committed to fiatconnect/fiatconnect-types by renovate[bot] a year ago
- chore(dev-deps): ⬆️ update devdependencies (non-major) (minor) (#136) [](https://renovatebot.com) This PR contains the following update... — committed to timelessco/next-ts-app by renovate[bot] a year ago
- fix(deps): update dependency zod to v3.21.4 (#2313) [](https://renovatebot.com) This PR contains the following updates: | Package | Ch... — committed to tf2pickup-org/server by renovate[bot] a year ago
- chore(deps): update dependency zod to v3.21.4 (#128) [](https://renovatebot.com) This PR contains the following updates: | Package | C... — committed to sebald/pattern-analyzer by renovate[bot] a year ago
- fix(deps): update dependency zod to v3.22.3 [security] (#621) [](https://renovatebot.com) This PR contains the following updates: | Pa... — committed to Garlic-Team/gcommands by xHyroM 4 months ago
I’ve been experiencing a similar performance issue.
TypeScript autocompletion is extremely slow in VS Code when
zod@3.20.2package is installed, the CPU usage spikes to 100% and it usually takes 3-4 seconds to load the suggestions. After removingzodor downgrading it tov3.19.1the issue is gone. You can see more details in the related stackoverflow post I created: https://stackoverflow.com/questions/74881472/slow-typescript-autocompletion-in-vs-code-for-zod.It’s worth mentioning that this issue also occurs in Webstorm, so I’m convinced it’s not VSCode-related.
Okay, I found the cause of all the problems. It seems to be TSDX 0.14.1, which can cause some weird issues with TypeScript error check because it doesn’t support the latest version of TS and hasn’t been updated in 2 years (!) In my case, the solution was to switch to DTS-CLI, which runs and builds super fast without any problems with Zod.
I hope this has helped someone.
v30.20.6still has the mentioned bugs. The build just hangs forever and intellisense (webstorm) becomes highly unresponsive.@colinhacks You are still unconvinced it should have been a semver major 😃?