Can I use nuxt ui without vue router
I'm building an electron app so there's not much use for a router. Trying to run without vue-router throws this error at runtime
Uncaught SyntaxError: The requested module '/@id/__vite-optional-peer-dep:vue-router:@nuxt/ui' does not provide an export named 'useRoute'
I can just install vue-router and not define anything but it'd be great if nuxt ui didn't depend on vue-router
Hope this is doable2 Replies
Hi @StefanH. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Nuxt UI is designed to work with Vue Router, even in non-Nuxt Vue projects. The official installation guides for both Nuxt UI and Nuxt UI Pro in Vue projects explicitly include vue-router as a required dependency. If you're using pnpm, the documentation specifically instructs you to install tailwindcss, vue-router, and @unhead/vue in your project's root directory for things to work correctly. The error you encountered (
Nuxt UI requires vue-router to be installed, even if you do not use routing in your app. There is no supported way to use Nuxt UI without vue-router. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
does not provide an export named 'useRoute'
) is a result of Nuxt UI attempting to auto-import composables like useRoute, which are provided by vue-router.
There is no documented way to use Nuxt UI without vue-router. Even if you do not define any routes, vue-router must be present for Nuxt UI to function properly in a Vue (or Electron) project. The recommended approach is to install vue-router as a dependency, even if you do not use it for navigation in your app. This will resolve the runtime errors and allow Nuxt UI to work as expected Nuxt UI Vue installation guide.
In summary:Nuxt UI requires vue-router to be installed, even if you do not use routing in your app. There is no supported way to use Nuxt UI without vue-router. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@211558054947192834> Kapa.ai is still learning and improving, please let me know how I did by reacting below.