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

Forms Resolver: yupResolver import error #6722

Open
jsodeman opened this issue Nov 3, 2024 · 6 comments
Open

Forms Resolver: yupResolver import error #6722

jsodeman opened this issue Nov 3, 2024 · 6 comments
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Milestone

Comments

@jsodeman
Copy link

jsodeman commented Nov 3, 2024

Describe the bug

Importing the yupResolver results in an error:

"[plugin:vite:import-analysis] Failed to resolve entry for package "@primevue/forms". The package may have incorrect main/module/exports specified in its package.json."

Importing the yupResolver by pointing to the yup sub-folder works, though the IDE shows an error

image

So it looks like the resolver isn't being passed up to the top level exports from the resolvers library.

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-6bfxlz?file=src%2FApp.vue

PrimeVue version

4.2.1

Vue version

4.x

Language

ES6

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

import { yupResolver } from '@primevue/forms/resolvers';

Expected behavior

No response

@jsodeman jsodeman added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 3, 2024
@mertsincan
Copy link
Member

Please don't use import { yupResolver } from '@primevue/forms/resolvers';. You need to import from @primevue/forms/resolvers/yup in 4.2.1. Could you please try it after clearing whole caches?

...The forms library provide built-in resolvers for popular options including Zod, Yup, Joi, Valibot, and Superstruct that can be be imported from @primevue/forms/resolvers/* path.

@DynamicLoader
Copy link

The whole file of @primevue/forms/resolvers/* is empty. What does it export...

@mertsincan
Copy link
Member

It uses @primeuix/forms API. https://www.npmjs.com/package/@primevue/forms?activeTab=code

Did you try our sample stackblitz link?

@DynamicLoader
Copy link

So similar of the name...
Just install it and OK!

@jsodeman
Copy link
Author

jsodeman commented Nov 4, 2024

I cleared the IDE caches and deleted node_modules and package-lock.json.

ESLint: yupResolver not found in '@primevue/ forms/ resolvers/ yup'(import/ named)

The stackblitz linked in the docs has a similar error

https://primevue.org/forms/#resolvers
image

@jarrednorrisdev
Copy link

Having the same problem trying to import the zodResolver,

Package Versions:

"@primevue/forms": "^4.2.1",
"@primevue/themes": "^4.2.1",
"primevue": "^4.2.1",

Import Statement:

import { zodResolver } from '@primevue/forms/resolvers/zod';

Error:

Module '"@primevue/forms/resolvers/zod"' has no exported member 'zodResolver'.

Flesky added a commit to Flesky/msti that referenced this issue Nov 6, 2024
@mertsincan mertsincan added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 6, 2024
@mertsincan mertsincan added this to the 4.2.2 milestone Nov 6, 2024
@tugcekucukoglu tugcekucukoglu modified the milestones: 4.2.2, 4.2.3 Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
None yet
Development

No branches or pull requests

5 participants