App-vite SSR does not inject the styles at initial render in development
See original GitHub issueWhat happened?
The first HTML send to the client with SSR does not contain style
tags, which causes a flash of unstyled content. This is related to https://github.com/vitejs/vite/issues/2282 and https://github.com/vitejs/vite/issues/2013. I think there are workarounds possible but I think those should be handled by Quasar internally.
This only happens when in development but that leads to a very bad developer experience, because you then have to assume it will only happen on development.
What did you expect to happen?
Styles should be present at first load
Reproduction URL
Repro based on project starter
How to reproduce?
- Create a new starter project with Vite
- Run dev mode with SSR
- In the browser disable javascript and reload the page to see the initial page without styling.
- Inspect the source
Ctrl + u
to see that there are indeed nostyle
tags present
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite), SSR Mode
Platforms/Browsers
No response
Quasar info output
Operating System - Windows_NT(10.0.22000) - win32/x64
NodeJs - 16.14.0
Global packages
NPM - 8.3.1
yarn - 1.22.17
@quasar/cli - 1.3.0
@quasar/icongenie - 2.3.0
cordova - Not installed
Important local packages
quasar - 2.6.0 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
@quasar/app-vite - 1.0.0-beta.2 -- Quasar Framework App CLI with Vite
@quasar/extras - 1.13.0 -- Quasar Framework fonts, icons and animations
eslint-plugin-quasar - Not installed
vue - 3.2.31 -- The progressive JavaScript framework for building modern web UI.
vue-router - 4.0.14
pinia - 2.0.11 -- Intuitive, type safe and flexible Store for Vue
vuex - Not installed
vite - 2.8.6 -- Native-ESM powered web dev build tool
eslint - 8.11.0 -- An AST-based pattern checker for JavaScript.
electron - Not installed
electron-packager - Not installed
electron-builder - Not installed
register-service-worker - 1.7.2 -- Script for registering service worker, with hooks
@capacitor/core - Not installed
@capacitor/cli - Not installed
@capacitor/android - Not installed
@capacitor/ios - Not installed
Quasar App Extensions
*None installed*
Networking
Host - METT-EVERT
Ethernet 2 - 192.168.2.15
Relevant log output
No response
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
SSR CSS injection in development · Issue #2282 · vitejs/vite
SSR HTML transformation in middleware mode doesn't add style tags for ... App-vite SSR does not inject the styles at initial render in...
Read more >Why insert style again on client-side when using ssr? (from ...
And It says to prevent FOUC, we should inject style to rendered HTML on server side. This was very clear. But after that,...
Read more >How To Render CSS on React App Servers | DigitalOcean
Use web developer tools to inspect the page source. The content is rendered to the server, but it doesn't show any style anywhere...
Read more >What is SSR | Quasar Framework
Quasar and Vue.js are frameworks for building client-side applications. By default, Quasar Vue components produce and manipulate DOM in the browser as ...
Read more >Build Your Own SSR/SSG From Scratch with Vite and React
renderToString in your server to render your components. There are some caveats if you go down that path. TTFB(Time To First Byte) will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rstoenescu I’m not sure if this has already been fixed, but this seems to work: https://github.com/vitejs/vite/issues/2282#issuecomment-1079659649
@rstoenescu I’m currently running into this limitation again, would it be possible to see if we can include the method mentioned above in Quasar as well?
Or if not in Quasar generically is there a way we can implement this for ourselves using SSR middleware or something like that?