primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.55k stars 1.23k forks source link

Forms Resolver: yupResolver import error #6722

Open jsodeman opened 1 week ago

jsodeman commented 1 week ago

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

mertsincan commented 1 week ago

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 commented 1 week ago

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

mertsincan commented 1 week ago

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

Did you try our sample stackblitz link?

DynamicLoader commented 1 week ago

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

jsodeman commented 1 week ago

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 commented 1 week ago

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'.