Closed korbinzhao closed 1 month ago
This is expected with Vite's CSS handling (even in an SPA setup), as modules are loaded lazily and CSS may be loaded after. Many metaframeworks are able to mitigate this though by crawling the entrypoint (in this case entry-server.tsx
) and detect all the CSS, and then inline them into the initial HTML. There's more information at https://github.com/vitejs/vite/issues/16515.
While the template could add some code to prevent the FOUC, I prefer to keep it as minimal as possible as a start. Perhaps when Vite can expose an API to make the crawling simpler, the template could use it to prevent this issue.
When using the template-ssr-react-streaming-ts, I encountered an issue where the page styles flicker in development mode due to SSR content being rendered before the style files. How should this be resolved?