Skip to content

Sub-path import issues with @hookform/resolvers/zod in modern bundlers #839

@foudhilriahi

Description

@foudhilriahi

Description

Hi team! 👋

While working on a personal project, I encountered persistent import issues with @hookform/resolvers/zod:
Cannot find module '@hookform/resolvers/zod'

Environment

  • Bundler: Vite / Next.js
  • TypeScript: 5.x
  • Zod: v4+
  • react-hook-form: v7+

What I tried

  • Reinstalling @hookform/resolvers
  • Different import styles
  • Checking tsconfig moduleResolution settings

Workaround

I ended up creating a minimal standalone resolver as a workaround: zod-resolver-lite

It's just ~50 lines that:

  • Handles nested array paths (items[0].name)
  • Supports criteriaMode: "all"
  • Uses only non-deprecated Zod v4 APIs

Not a complaint!

I'm not asking for changes—just sharing in case:

  1. Others hit the same issue
  2. It helps with documentation or troubleshooting guides
  3. There's something obvious I missed that could help others

Thanks for the amazing library! ❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions