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

Nuxt module: autoImport logic inverted #6187

Open
Brads3290 opened this issue Aug 6, 2024 · 3 comments
Open

Nuxt module: autoImport logic inverted #6187

Brads3290 opened this issue Aug 6, 2024 · 3 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@Brads3290
Copy link

Describe the bug

With the following nuxt.config.ts, auto-imports are not generated:

export default defineNuxtConfig({
    modules: ['@primevue/nuxt-module'],
    primevue: {
        autoImport: true, // Or leave blank, which should default to true. Either way, auto-imports do not work.
        // .. other options
    }
})

Looking in .nuxt/components.d.ts, no PrimeVue components are registered.

Now, set autoImport: false, and all the components appear in components.d.ts.

This is due to this line here:

!moduleOptions.autoImport && addComponent(opt);

The logic for registering the component with Nuxt is inverted.

Reproducer

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

PrimeVue version

4.0.3

Vue version

3.x

Language

TypeScript

Build / Runtime

Nuxt

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@Brads3290 Brads3290 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 6, 2024
@Brads3290
Copy link
Author

In the meantime, a workaround is to turn autoImport off:

export default defineNuxtConfig({
    modules: ['@primevue/nuxt-module'],
    primevue: {
        autoImport: false,
        // .. other options
    }
})

@j0rgedev
Copy link
Contributor

j0rgedev commented Aug 6, 2024

Hope this gets merged soon 🙌. Found some issues regarding this, so I needed to turn autoImport off

@blamze
Copy link

blamze commented Aug 7, 2024

Hopefully, this PR fix will improve IntelliJ IDE support.

Before, none of auto imported components had navigation to the source.
After turning autoImport: false components get the connection, although prop suggestions for me still not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

3 participants