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

Incompatible with Vuetify #591

Closed
scscgit opened this issue May 4, 2023 · 5 comments
Closed

Incompatible with Vuetify #591

scscgit opened this issue May 4, 2023 · 5 comments

Comments

@scscgit
Copy link

scscgit commented May 4, 2023

I can't find a valid combination to use with Vuetify. I created an issue at @nuxt-alt/vuetify, where the vite-plugin-vuetify causes error Vuetify plugin must be loaded after the vue plugin:

This is caused by vite:extendConfig Nuxt hook not having the vite:vue Plugin accessible, so it can't reorder it. (Using vite:configResolved hook instead didn't work either.)

Note that this issue only occurs when vitest.config.mjs is used, so I assume there may be some nuxt-vitest-specific zero-config Vite misconfiguration. I'd appreciate any hints about the root cause (or alternatives).

Copy link
Member

Could you provide a reproduction? 🙏

@scscgit
Copy link
Author

scscgit commented May 4, 2023

Sure, here is the same content from the linked issue:

  • Install dependencies:
    "nuxt": "^3.4.3",
    "@nuxt-alt/vuetify": "^1.1.1",
    "nuxt-vitest": "^0.6.10",

  • Add both modules to nuxt.config.ts (any order):

export default defineNuxtConfig({
  modules: ['nuxt-vitest','@nuxt-alt/vuetify']
})
  • Add file vitest.config.mjs to the project root directory with the following content:
import { defineVitestConfig } from 'nuxt-vitest'

export default defineVitestConfig({})
  • (Optional) add any test

  • Run npm run test with script in package.json:

"scripts": {
    "test": "vitest",
  },

Following error occurs:

> vitest
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: Vuetify plugin must be loaded after the vue plugin
    at configResolved (~\node_modules\vite-plugin-vuetify\dist\importPlugin.js:19:23)

(as the config.plugins.findIndex(plugin => plugin.name === 'vite:vue') unexpectedly matches the plugin.)

@danielroe
Copy link
Member

I meant, would you create a runnable reproduction, e.g. from https://stackblitz.com/github/nuxt/starter/tree/v3.

Copy link
Member

Added a template you can use: https://stackblitz.com/edit/nuxt-vitest

@scscgit
Copy link
Author

scscgit commented May 4, 2023

Wow, it seems this issue has been already fixed in version 0.6.11 (my repro referenced 0.6.10).

Here is a repro using old version with the error: https://stackblitz.com/edit/nuxt-vitest-qahjva?file=package.json

You can thus probably link this issue with the closed PR danielroe/nuxt-vitest#148

Though just out of curiosity, maybe you could also provide your feedback regarding if there is a possible workaround with the old version. Thanks anyway!

@danielroe danielroe transferred this issue from danielroe/nuxt-vitest Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants