nuxt: Build and dev mode are slow and got errors in logs when importing Vuetify 3 with Vite-plugin-vuetify
Environment
- Operating System:
Darwin - Node Version:
v18.10.0 - Nuxt Version:
3.0.0-rc.13 - Nitro Version:
0.6.1 - Package Manager:
npm@8.19.2 - Builder:
vite - User Config:
app,runtimeConfig,build,vite,imports,modules - Runtime Modules:
(),@pinia/nuxt@0.4.3 - Build Modules:
-
Reproduction
Here the link of the stackblitz: https://stackblitz.com/edit/github-2wrsdj?file=nuxt.config.ts
I tried to clean and keep only the concerned code.
Below, the code that make the bug:
nuxt-config.ts
Describe the bug
Hello,
i have this logs on dev mode and build time, from rc-11 to the rc-13 ( _thanks a lot for your work by the way ) . It make the build and the dev mode slow.
I don’t know why, it seems like it doesn’t find vuetify components on SSR during the build time and npm run dev.
When i start the dev, the rendering is good after hydration.
...
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VMain/VMain.sass"
...
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VPagination/VPagination.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VParallax/VParallax.sass"
...etc
Do you have any idea ? What i’m doing wrong ? I’m not sure this is a bug or a misunderstanding by me. All the currents tuto on vuetify 3 / nuxt 3 just explain how to use it but none of them are talking about custom css that need to be import on vite:extendConfig
Hope there will be an official integration of vuetify 3 / nuxt 3
Thank you for your help.
Additional context
No response
Logs
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:styles/main.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:styles/main.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:styles/main.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:styles/main.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VApp/VApp.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VApp/VApp.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VApp/VApp.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VApp/VApp.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VAppBar/VAppBar.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VAppBar/VAppBar.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VAppBar/VAppBar.sass"
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VAppBar/VAppBar.sass"
....
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 21
- Comments: 121 (36 by maintainers)
Vuetify:
3.2.5Nuxt:3.5.0the problem still EXIST!
Temporary solution :
server/plugins/vuetify-fix.tsI’m having the same output/error and get 404 errors on the browser console when running npm run dev.
The error appears only when having a specific configuration file for styles - i.e, doesn’t happen when pushing vuetify onto Vite plugins without arguments.
I followed the same tutorial and I’m not sure what’s the correct way of importing vuetify via Vite yet, so it might be related.
Last Friday : yes 😕
@ItsMeDelanoDev here is the link to the repo with the customized variables working: https://github.com/BayBreezy/vuetify3-nuxt3-sass-customized
I also hosted it on Netlify with no trouble: https://v3customized.behonbaker.com/ Again, thanks @mhfeizi - That plugin saved me lol
@BayBreezy that sucks cause Vite is much better.
Any idea where this bug belongs, so we could move it there? Please no further off-topic discussion about the pro’s and con’s of vuetify here.
Still an issue Nuxt
3.7.0Vuetify3.3.14Thanks @BayBreezy! I think we’re making progress in finding the reason.
@danielroe please also have a look at the information in the comments marked “Off Topic” over there, I guess especially my last one helps to compare the results.
TL;DR: vuetify-loader prepends a \0 to the path for indication and with nuxt (perhaps as
/_nuxt/is prepended) this never gets removed again. That seems to cause these issues. The maintainer wrote, with vite-only that doesn’t happen.I guess for reproduction, this guide & repo can be used: https://codybontecou.com/how-to-use-vuetify-with-nuxt-3.html
Here my pr https://github.com/vuetifyjs/vuetify-loader/pull/332
Nuxt reproduction there (link to open the repo in stackblitz in the readme file) using a local vite plugin tgz, you can remove the dependency and add the vuetify plugin and run the
dev:sourcemapscript.Right now we also have some vue router warnings in nuxt.
The problem, vite will not show the sourcemap map. The missing source warnings is because entries in sources array in the sourcemap with file:/// prefix.
It seems a bug in nuxt with default resolved virtual module prefix
\0. Devtools cannot show some virtual using it (found same problem in i18n module). I guess the bug is about using that prefix wrongly, since vuetify is changing the entry point and should use a custom prefix to resolve the styles: check the last paragraph before previous section here https://vitejs.dev/guide/api-plugin.html#universal-hooksI fix it in my nuxt module with a copy/paste from the original vuetify styles plugin using another prefix and handling ssr properly.
I Will try to add those changes to vuetify nuxt module.
I Will also try esbuild.
Still an issue Nuxt
3.6.5Vuetify3.3.12I have created a new nuxt module here vuetify-nuxt-module:
@nuxtjs/i18nsupportHere a StackBlitz example: https://stackblitz.com/edit/nuxt-starter-9fybba
Nuxt got updated… Same issue 😦
So after the nuxt update to 3.1.1, he issue is back. Long load time and the warnings are now in the VSCode terminal instead of the browser console
@mostafaznv
With the upgrade to Vue3, Nuxt, Vuetify, and their surrounding libraries are still not aligned, but as far as Vuetify is concerned, the reason is that almost all of them use
vite-plugin-vuetifyinternally.It is located in
https://github.com/vuetifyjs/vuetify-loader/blob/c4ead7300f63b702d96945440db6dd61835097dc/packages/shared/src/imports/getImports.ts#L24
Probably the most effective solution would be wait for this PR to be merged.
https://github.com/vuetifyjs/vuetify-loader/pull/313
By the way, it can also be improved by replacing with a general-purpose plugin such as esbuild-sass-plugin instead of vite-plugin-vuetify.
I think many developers, myself included, don’t understand that upgrading Vue3 and Nuxt3 involves fundamental changes. It is supposed to be a more general-purpose and effective modification than before, but it seems that it is a modification that will lead to a decrease in development efficiency if it is tied to the existing source.
@jd-solanki I think we should give this module a try. I think it fixes the issues outlined here: https://vuetify-nuxt-module.netlify.app/ I have not pressure tested it yet in terms of customization but it takes the sass variables and shows no error in the console. Plus the build & dev server start time (on a mac) is fast.
Hey @danielroe
Is there any way we can prevent this logs:
I tried using custom logger mentioned in this issuse by you but didn’t work:
After 3 years of my decision, I would not choose or recommend vuetify now. There’s better alternative (but with less components) like radix vue & Nuxt UI.
@Hebilicious The problem occurs when you try to add
configFileto customize Vuetify SASS variables:check this reproduction link
the more component you use, the slower the application becomes.
Amazing investigation. I will look into this further on the Nuxt end.
So you have it all working perfectly fine? I cannot get it to work, even with your suggestions in this thread.
So you don’t have a very slow development environment, no toolbar/layout shifts the first seconds while it is loading?
If so, would it be possible for you to create a demo repository? That would be appreciated! I am currently doing some research towards Nuxt 3 compatible UI frameworks & libraries and would like to work with Vuetify.
nuxt.config.ts
plugins/vueytify.ts
If there’s something we can fix in Nuxt, we will. (which is why I asked for a reproduction.) But as far as I’m aware these stem from issues with Vuetify.
also note there is an excellent module by @userquin which solves these issues for Nuxt users.
https://github.com/itelmenko/nuxt3-vuetify3-customisation
In browser dev console I see a lot of errors:
npm_run_dev.log
If I add server plugin
then I don’t see errors in browser console, I dont see
[Vue Router warn]: No match found for location with path "/_nuxt/%EF%BF%BDplugin-vuetify:components/VApp/VApp.sass"in linux console (terminal). But I see errors likeWARN Sourcemap for "plugin-vuetify:components/VSlideGroup/VSlideGroup.sass" points to missing source filesstill.Anyone looking for Nuxt+Vuetify flavours, I have been doing a lot of trial & errors to setup some starter templates, and I have these three repos using this module (https://vuetify-nuxt-module.netlify.app/).
Based on my limited testing, these templates are not throwing any errors/warnings. All these repos build fine, so they include netlify demo urls.
Feel free to improve these templates by testing them at your end, and share them with the rest of us. Also, note that all three repos have a “blank” branch, which scaffolds just the project skeleton with an empty
index.vue(just a single span), for a fresh start. Also, the tailwind & unocss ones use !important flag in their config to take precedence over the vuetify’s generous use of !important.As @userquin stated correctly, sass is slow, so these templates have sass override (for components) in nuxt.config.ts commented out. If you want to override component’s sass variables, uncommented these two in the nuxt config file.
We will get there eventually!
I would definitely advise using the module. This is not an issue with Nuxt as far as I can tell (nor something to fix within Nuxt)…
I think since neither nuxt nor vuetify devs have shown interest in fixing this, it probably makes more sense to start using and maintaining the vuetify-nuxt module…
I guess yes, But let’s not divert the conversation from the original issue.
If anyone gets some solution regarding vuetify please share.
Hi @jd-solanki ,
I took a look to radix vue. Interesting option.
Is radix vue production ready?
@derHodrig This is called Hybrid rendering. According to best of my knowledge, Below is identical to your snippet:
Not sure why you posted it here, it will be misleading to those researching.
@Hebilicious no, using sass will be slow, I’ll try to find alternatives to not block/degrade the app and improve DX experience, I don’t promise anything
Does your module fix the SASS issue mentioned by @KareemDa ?
I’m experiencing the same issue now!
OMG I spent a whole working day on this. Thanks @BayBreezy your working example should be mentionned everywhere, especially there https://codybontecou.com/how-to-use-vuetify-with-nuxt-3.html !!!
Legend, thank you!
REPO: https://stackblitz.com/edit/nuxt-starter-xddf1p?file=nuxt.config.ts Here is a repo… As the ppl stated above, configuring the SASS vars give weird errors in the browser console (which stopped me personally from deploying the app to Netlify).
This plugin saved the day for me --> https://github.com/nuxt/nuxt/issues/15412#issuecomment-1398110500 Sadly, @KareemDa is using PNPM and the mentioned plugin did not help his case.
I’m referring to the original repro: https://stackblitz.com/edit/github-2wrsdj?file=nuxt.config.ts
Thank you so much for providing help. Waiting for an expert to figure out how to solve this issue
Ohhhhhhhhh… Ouch… i have never used PNPM… I really don’t know how to help you fix that… The PNPM experts would have to take a look at that
Actually the main repo is a little bit complex (monorepo) and private. but it has a project with (vuetify 3 + Nuxt 3) with 100% the same config as yours. But unfortunately, It’s not working.
UPDATE After a deep look. the problem seems with using PNPM as a package manager! your project won’t work with pnpm. but it WILL work with npm !
What a problem!
UPDATE 2 from vuetify documentation:
How to solve this ?!
Yeah, Vuetify 3.1.2 & Nuxt 3 showing errors in browser console when I customize SASS vars. They only get displayed when
ssr: trueinsidenuxt.config. I also cannot deploy the app to netlify because of the errors.One of the many errors received:
Failed to load resource: the server responded with a status of 404 (Page not found: /_nuxt/%EF%BF%BDplugin-vuetify:components/VAppBar/VAppBar.sass).I don’t know why this gets added
%EF%BF%BDYes it’s still here unfortunately
I’m using Nuxt 3.13 along with Vuetify 3.0.1 and also experiencing long load times in dev mode. Here is my plugins/vuetify.ts config that may help with some of the 404 component errors above:
The import * comopnents and * directives I think are key.
@mhfeizi thank you. Unfortunately, I still have the same errors in the Browser console and in the terminal. But your answer helped me understand and remove some of the misconfigurations I had. What do you have in assets/vuetify.settings.scss?