-
Notifications
You must be signed in to change notification settings - Fork 10
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
Failed to resolve component #68
Comments
Hi, since formkit-primevue inputs depends on primevue inputs, there is a problem with primevue nuxt auto import mechanism, because only inputs detected on your source code are loaded automatically. Solution 1: define under the plugins directory a new plugin like formkit.ts import {usePrimeInputs} from "@sfxcode/formkit-primevue";
// optional: import styles
import "@sfxcode/formkit-primevue/dist/style.css";
export default defineNuxtPlugin(nuxtApp => {
const app = nuxtApp.vueApp
// register inputs needed for primevue
const { registerInputs } = usePrimeInputs()
registerInputs(app)
}) (This solution is also used in the formkit-primevue-nuxt module) Solution 2: Do not rely on autoimports, but configure needed imports in the component section of the nuxt primevue config. Solution 3 (maybe not the best but working): include your needed primevue components somewhere in your source code, even if not visible (eg v-if="false") primevue Hope that will help you, Have a nice coding time, Tom |
Hi Tom, Thanks for the advice. Solution 1 works. However, I couldn't get solutions 2 and 3 to work (I updated my repro with a branch that includes both changes). Solution 2 is what the docs say, but I can't get it to work by configuring the primevue Nuxt module (with Maybe solution 1 is the only viable option for Nuxt (aside from using the formkit-primevue module)? Note: while I was waiting for your reply I found a different workaround: I cloned your repo and edited all the |
Hmm.. I just realised in order for export default defineNuxtConfig({
compatibilityDate: "2024-11-01",
modules: ["@formkit/nuxt", "@primevue/nuxt-module"],
primevue: {
autoImport: false,
components: {
include: "*",
exclude: ["Form", "FormField"], // You don't have to exclude these but if you leave them included, you need to add @primevue/forms as a dependency
},
options: {
theme: {
preset: Aura,
},
},
},
devtools: { enabled: true },
}); I'm still getting some errors with this configuration so I think I'll just stick with your Solution 1 instead of trying to get this config right. |
Using the latest version of
@sfxcode/formkit-primevue
(2.7.5), formkit (1.6.9), and primevue (4.2.5), I getFailed to resolve component
when trying to use primevue components in formkit.It looks like it's successfully rendering the
formkit-primevue
component (e.g. this component), but inside that component it's failing to resolve the actual PrimeVue component.My setup is pretty simple:
@sfxcode
Nuxt module)@sfxcode/formkit-primevue
@sfxcode/formkit-primevue
in theformkit.config.ts
, as described hereI made a full repro here: https://github.com/Brads3290/formkit-primevue-repro
package.json
Screenshot:

The text was updated successfully, but these errors were encountered: