primevue icon indicating copy to clipboard operation
primevue copied to clipboard

Error with Form import

Open jcham opened this issue 8 months ago • 40 comments

Describe the bug

Version 4.2.5 fails to launch with this error:

`tryout-2 on  main [!] via ⬢ v20.18.0 using ☁️ default/ ➜ yarn run dev yarn run v1.22.17 $ nuxt dev [ nuxi 11:50:28 AM] Nuxt 3.16.0 with Nitro 2.11.6 [11:50:28 AM] ➜ Local: http://localhost:3000/ ➜ Network: use --host to expose

[nuxt:tailwindcss 11:50:29 AM] ℹ Using default Tailwind CSS file [11:50:29 AM] ➜ DevTools: press Shift + Option + D in the browser (v2.2.1)

[11:50:30 AM] ℹ Re-optimizing dependencies because lockfile has changed [11:50:30 AM] ✔ Vite client built in 38ms [11:50:30 AM] ✔ Vite server built in 301ms

[11:50:30 AM] ERROR Pre-transform error: Failed to resolve import "@primevue/forms/form?nuxt_component=async&nuxt_component_name=Form&nuxt_component_export=default" from "virtual:nuxt:%2FUsers%2Fjcham%2FGit%2FML%2Ftryout-2%2F.nuxt%2Fcomponents.plugin.mjs". Does the file exist? Plugin: vite:import-analysis File: virtual:nuxt:%2FUsers%2Fjcham%2FGit%2FML%2Ftryout-2%2F.nuxt%2Fcomponents.plugin.mjs:122:23 120| import LazyTag from 'primevue/tag?nuxt_component=async&nuxt_component_name=Tag&nuxt_component_export=default'; 121| import LazyTerminal from 'primevue/terminal?nuxt_component=async&nuxt_component_name=Terminal&nuxt_component_export=default'; 122| import LazyForm from '@primevue/forms/form?nuxt_component=async&nuxt_component_name=Form&nuxt_component_export=default'; | ^ 123| import LazyFormField from '@primevue/forms/formfield?nuxt_component=async&nuxt_component_name=FormField&nuxt_component_export=default'; 124| const lazyGlobalComponents = [

[11:50:31 AM] WARN "@primevue/forms/formfield/style" is imported by "virtual:#primevue-style", but could not be resolved – treating it as an external dependency.

[11:50:31 AM] WARN "@primevue/forms/form/style" is imported by "virtual:#primevue-style", but could not be resolved – treating it as an external dependency.

[nitro 11:50:32 AM] ✔ Nuxt Nitro server built in 1375ms [11:50:32 AM] ℹ Vite client warmed up in 2ms [11:50:33 AM] ℹ Vite server warmed up in 869ms`

Pull Request Link

No response

Reason for not contributing a PR

  • [ ] Lack of time
  • [x] Unsure how to implement the fix/feature
  • [ ] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/primevue-4-vite-issue-template-ho3kkhjn

Environment

Fails in a plain vanilla brand new nuxt project

Vue version

3.5.13

PrimeVue version

4.3.2

Node version

No response

Browser(s)

Any

Steps to reproduce the behavior

Create a brand new Nuxt project. Follow steps to install TailwindCSS. Follow steps to install latest (4.3.2) version of PrimeVue. Run yarn run dev, error above happens. Doesn't seem to happen under Vite in the Stackblitz example (is there a template for Nuxt?).

Expected behavior

Should launch under dev and work.

jcham avatar Mar 12 '25 17:03 jcham

Same since updating to nuxt 3.16.0 not sure if it is related to this issue in nuxt

sbruegel avatar Mar 12 '25 17:03 sbruegel

@jcham I also got this error. Solved it by installing the @primevue/forms lib too, npm install @primevue/forms

Temporary solution, but feels like the should add it as a dependency of primevue if it has to be used.

Willen17 avatar Mar 12 '25 20:03 Willen17

@jcham I also got this error. Solved it by installing the @primevue/forms lib too, npm install @primevue/forms

Temporary solution, but feels like the should add it as a dependency of primevue if it has to be used.

And if you didn't use its <Form /> or <FormField /> components, you can set excludes subproperty of the primevue property in the nuxt.config.ts.

Image

I thought maybe I can yield a PR for this.

wangziling avatar Mar 13 '25 02:03 wangziling

I have the same issue.

On my project I use Form, so I cannot exclude it. I would need to downgrade versions a bit. What's the last working version?

offbit-it avatar Mar 13 '25 11:03 offbit-it

+1

ampstreamio avatar Mar 13 '25 11:03 ampstreamio

+1

kristijan11b avatar Mar 13 '25 11:03 kristijan11b

+1

josephjoeljo avatar Mar 13 '25 17:03 josephjoeljo

+1

machfluree avatar Mar 13 '25 18:03 machfluree

+1

paolieri avatar Mar 14 '25 02:03 paolieri

+1, does this issue come with nuxt 3.16?

hvpexe avatar Mar 14 '25 19:03 hvpexe

+1, does this issue come with nuxt 3.16?

I am on 3.15.4 and primevue is the same version as the op

josephjoeljo avatar Mar 14 '25 19:03 josephjoeljo

+1 xD

gerardmrk avatar Mar 19 '25 04:03 gerardmrk

+1 "primevue": "^4.0.3", "nuxt": "^3.12.2",

hnvibe8 avatar Mar 19 '25 04:03 hnvibe8

+1

"@primeuix/themes": "^1.0.0", "nuxt": "^3.16.0", "primevue": "^4.3.2", "devDependencies": { "@primevue/nuxt-module": "^4.3.2", }

omar-shaheen avatar Mar 19 '25 10:03 omar-shaheen

+1

Dennis4720 avatar Mar 19 '25 13:03 Dennis4720

+1

DMiradakis avatar Mar 20 '25 08:03 DMiradakis

I hope the problem gets fixed quickly, as I’m stuck relying on it. 😢

omar-shaheen avatar Mar 20 '25 10:03 omar-shaheen

+1

alexpopovme avatar Mar 21 '25 11:03 alexpopovme

+1

hodgevk avatar Mar 22 '25 06:03 hodgevk

+1

he-jialin avatar Mar 23 '25 04:03 he-jialin

+1

VladKarandashov avatar Mar 23 '25 05:03 VladKarandashov

+1

JuicySoup avatar Mar 24 '25 03:03 JuicySoup

+1

Ranzeplay avatar Mar 29 '25 14:03 Ranzeplay

Any news about this?

Curs3W4ll avatar Mar 31 '25 18:03 Curs3W4ll

I can't believe a huge breaking error is unresolved for a month, along with the FOUC issue that has been present since the release of v4, starting to think I'll be an ex-Primevue fan.

NamesMT avatar Apr 01 '25 07:04 NamesMT

+1

robugpl avatar Apr 01 '25 21:04 robugpl

I was facing the same issue, but I didn't use it. I solved it by installing @primevue/forms using npm install @primevue/forms.

[error] [ nuxi ] Nuxt Build Error: [31m[vite]: Rollup failed to resolve import "@primevue/forms/form?nuxt_component=async&nuxt_component_name=Form&nuxt_component_export=default" from

nirjondipo avatar Apr 06 '25 20:04 nirjondipo

Is there any (even rough) ETA on this one? I see it's tagged for 4.3.4 but with no due date yet

KyleBrown-804 avatar Apr 07 '25 22:04 KyleBrown-804

This is bad, issue has been open for one month and is pretty critical since a lot of users experience it. Bad rep.

[error] [ nuxi ] Nuxt Build Error: [vite]: Rollup failed to resolve import "primevue/floatlabel?nuxt_component=async&nuxt_component_name=FloatLabel&nuxt_component_export=default" from "virtual:nuxt:%2Fopt%2Fbuildhome%2Frepo%2F.nuxt%2Fcomponents.plugin.mjs".

and the fix that worked for @nirjondipo does not work since floatlabel is not a package.

npm install @primevue/floatlabel
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@primevue%2ffloatlabel - Not found
npm ERR! 404 
npm ERR! 404  '@primevue/floatlabel@*' is not in this registry.

*edit, excluded floatlabel since I'm not using it but now I get the same but for iconfield which I can't exclude since it's in use....

codekuu avatar Apr 08 '25 15:04 codekuu