primefaces / primevue

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

Nuxt module: `autoImport` logic inverted #6187

Open Brads3290 opened 2 months ago

Brads3290 commented 2 months ago

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: https://github.com/primefaces/primevue/blob/6e55ee9514af77125ff50f50e59f8e766dce1367/packages/nuxt-module/src/register.ts#L48

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 commented 2 months ago

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

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

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

blamze commented 2 months ago

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.