vuetifyjs / nuxt-module

Zero-config Nuxt Module for Vuetify
https://nuxt.vuetifyjs.com/
MIT License
225 stars 22 forks source link

vuetify+nuxt+vue-macros combination of components has stopped working #275

Open AndreyKindin opened 2 months ago

AndreyKindin commented 2 months ago

Hello, recently, the combination of vuetify+nuxt(-module)+vue-macros stopped working. If I remove Vue macros from the module, it seems to work. I'm not sure if I'm in the right place with the bug, but maybe just as a heads up that the bug exists. Here is the Stackblitz for it: https://stackblitz.com/edit/nuxt-starter-5xyynj?file=nuxt.config.ts

P.S.: If I try to implement the whole thing without the vuetify-nuxt-module, but rather via the plugin, I get the error: Cannot start nuxt: Vuetify plugin must be loaded after the vue plugin

at configResolved (node_modules/vite-plugin-vuetify/dist/index.cjs:29:15) at node_modules/vite/dist/node/chunks/dep-BaOMuo4I.js:66327:67 at Array.map () at resolveConfig (node_modules/vite/dist/node/chunks/dep-BaOMuo4I.js:66327:53) at async _createServer (node_modules/vite/dist/node/chunks/dep-BaOMuo4I.js:62687:18) at async buildClient (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.CMaRZVaO.mjs:745:24) at async withLogs (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.CMaRZVaO.mjs:1835:3) at async bundle (node_modules/@nuxt/vite-builder/dist/shared/vite-builder.CMaRZVaO.mjs:1826:3) at async bundle (node_modules/nuxt/dist/index.mjs:5888:5) at async build (node_modules/nuxt/dist/index.mjs:5763:3)

userquin commented 2 months ago

looks like something wrong in @vue-macros/nuxt, I'm going to try to fix it

userquin commented 2 months ago

@vue-macros/nuxt removing vite:vue plugin https://github.com/vue-macros/vue-macros/blob/main/packages/nuxt/src/index.ts#L41-L42, I'll send you a module to fix the problem and maybe detect @vue-macros/nuxt module here to move the internal plugins.

userquin commented 2 months ago

@AndreyKindin check my comment on vue macros issue (asked Kevin Deng about posible fix)

userquin commented 2 months ago

@AndreyKindin check https://stackblitz.com/edit/nuxt-starter-jq6cno?file=nuxt.config.ts,app.vue,package.json,.nuxt%2Fcomponents.d.ts again

It is using the pkg-pr-new from this PR https://github.com/vuetifyjs/nuxt-module/pull/276 and it is working since there is no dependency on vite:vue plugin (position) => moved to Nuxt component loader

I need to add directive auto import to Nuxt and we can remove custom Vuetify Vite plugin here: rn only used for directives ignoring any component or lab component auto import

sxzz commented 2 months ago

The reason is that Vue Macros will remove vite:vue plugin from the original plugin list and add it back into an array.

before: [a, 'vite:vue', b] after: [a, [b, 'vite:vue', c, d], e] now: [a, b, 'vite:vue', c, d, e]

This way it won't affect other plugins. Successfully fixed at https://stackblitz.com/edit/nuxt-starter-itabzd.

userquin commented 2 months ago

thx @sxzz ❤️