Skip to content

issue: "module not found" when importing zodResolver under Zod v3 #811

@TrevorBurnham

Description

@TrevorBurnham

Version Number

5.2.1

Codesandbox/Expo snack

https://codesandbox.io/p/devbox/romantic-burnell-vsq3yy

Steps to reproduce

  1. Install @hookform/[email protected] and [email protected]
  2. Import zodResolver

The import fails because it depends on zod/v4/core, which was added in [email protected].

Expected behaviour

I'd expect this kind of change to get a major version bump and a note in the release notes. Instead the release notes just say "retains compatibility with Zod v3".

The pull request that added the zod/v4/core import does mention this:

This PR bumps the minimum Zod version to 3.25.0…

But AFAICT that's just referring to the devDependencies bump. The PR also says:

I've designed this to continue working with Zod versions pre-3.25.0, but it's on a best-effort basis.

Maybe I'm missing something, but I'm not seeing how this could continue working with Zod versions pre-3.25.0…

Anyway, I spent some time scratching my head on this one since I'd wanted to upgrade my @hookform/resolvers dependency first before attempting a Zod v4 upgrade. I was able to resolve the problem once I learned that Zod 3.25.0 added the zod/v4/core path. I just wanted to file a ticket to save any other devs hitting this some time.

What browsers are you seeing the problem on?

No response

Relevant log output

✘ [ERROR] Missing "./v4/core" specifier in "zod" package [plugin vite:dep-pre-bundle]

    node_modules/.pnpm/@[email protected][email protected]/node_modules/@hookform/resolvers/zod/dist/zod.mjs:1:142:
      1 │ ...{appendErrors as o}from"react-hook-form";import*as n from"zod/v4/core";function t(r,e){try{var o=r()}catch(r){return e(r)}...

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions