Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to resolve path to module '@hookform/error-message' #11

Closed
ahmadkam2 opened this issue Jul 13, 2020 · 5 comments
Closed

Unable to resolve path to module '@hookform/error-message' #11

ahmadkam2 opened this issue Jul 13, 2020 · 5 comments

Comments

@ahmadkam2
Copy link

When I update react hook form version from 5.0.3 to 6.0.4, I faced this error
ErrorMessage component not exported from 'react-hook-form'
after installing npm install @hookform/error-message

and edit the imports to
import { ErrorMessage } from '@hookform/error-message';
I faced this error
Unable to resolve path to module '@hookform/error-message'

@bluebill1049 bluebill1049 transferred this issue from react-hook-form/resolvers Jul 13, 2020
@bluebill1049
Copy link
Member

that shouldn't be the case, can you reproduce this in codesandbox?

@alexypdu
Copy link

alexypdu commented Jul 13, 2020

While the statement import { ErrorMessage } from '@hookform/error-message'; functions normally in my case, however, the ESLint error import/no-unresolved: Unable to resolve path to module '@hookform/error-message' arises unexpectedly, and unintentionally changing the statement into import { ErrorMessage } from '@hookform/error-message/dist'; just suppress the error.

@phil-scott-78
Copy link
Contributor

I ran into this myself. I don't have a codesandbox but I did create a barebones CRA reproduction this morning. https://github.com/phil-scott-78/error-message-repo.

I've only done some brief troubleshooting, but looking at the files eslint is trying to resolve it looks like it isn't looking in the dist folder for index.js and is failing trying to resolve. This is on Windows fwiw

@phil-scott-78
Copy link
Contributor

Well that was easy enough once I had a reproduction. Looks like a dist was missing in package.json. Create a PR (#12)

@bluebill1049
Copy link
Member

patched thanks @phil-scott-78 very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants