Open AasmundN opened 1 year ago
@AasmundN you need to add vuetify
as a dependency.
@AasmundN Try disabling inlineSSRStyles
in your Nuxt config file, I'll try to figure out what's happening, the paths for scss files using absolute paths, should be prefixed with /@fs/
, Vuetify needs a deep review (disabling inline SSR Styles, the error should go away):
experimental: {
inlineSSRStyles: false,
}
@AasmundN you need to add
vuetify
as a dependency.
No? vuetify-nuxt-module
adds it as one of its dependencies.
@userquin Disabling inlineSSRStyles
seems to have fixed the problem. I'm guessing doing that shouldn't be necessary?
@userquin Disabling
inlineSSRStyles
seems to have fixed the problem. I'm guessing doing that shouldn't be necessary?
Experimental inlineSSRStyles
is enabled by default, we need to change the custom Vuetify styles plugin here to resolve/load SSR styles properly, I'm trying to fix it.
It seems using Vuetify configFile
styles and Nuxt inlineSSRStyles
are incompatible, there is no way to get individual chunks
Okay. Is that a problem? I'm not really familiar with what inlineSSRStyles does. Or how the styles are handled by Nuxt and Vite for that matter.
The problem is the nuxt nitro renderer, since we've some .sass references we will receive the request, but it is missing, I have it working just returning an empty string when receiving the id in Vite load hook with SSR flag: we'll receive requests like this /plugin-vuetify/lib/components/VDialog/VDialog.sass?inline&used
.
Since we're using Vuetify styles via configFile
we'll get the styles in the vuetify-theme-stylesheet
, maybe I can fix the error, but I have no idea if it has side effects...
This is the page without inlining SSR styles:
Inlining SSR styles:
Vuetify should avoid use SASS...
It is not working... maybe I have changed so many things that now it doesn't work in my local...
@AasmundN You can try it adding this simple Vite plugin to your nuxt config file, removing inlineSSRStyles: false
from experimental option:
vite: {
plugins: [{
name: 'vuetify-nuxt-inline-ssr-styles',
enforce: 'pre',
load(id, options) {
if (options?.ssr && id.startsWith('/plugin-vuetify/lib/'))
return ''
}
}]
}
Adding the Vite plugin also seems to work, and it does reduce the size of the css-file like you showed. However when I load the page from the production build there is a little "flick" of the styles, as if the styles are being applied a little after the html appears.
Yeah, the vite plugin doesn't seem to be working properly. Is using inlineSSRStyles important?
Still in the process of deciding what framework to choose for styling in my Nuxt project, and I would really like to use Vuetify as I have used it in other SPA, Vite projects. However, adding Vuetify to Nuxt has been quite painful and things don't seem to work properly at every other turn. I'm not so familiar with how Vite works, but I've been trying to understand wether or not this inline styles thing is a deal breaker or not, and thus if I should choose some other styling framework instead. Or would it just marginally change the load time. If it is important, will eventually work more into fixing it? Thank you for your work, a module like this one is really needed.
Having an issue when trying to build the app for production: https://ibb.co/HrsK1F3.
Here is my nuxt config:
My dependencies:
Help would be much appreciated.