How to use CSS Modules with TanStack Start?
I'm struggling to make CSS Modules work properly. Currently, the styles are being loaded only on the client, causing a flash of unstyled content (FOUC) during initial render.
I tried in this repo https://github.com/tanstack/router/tree/main/examples/react/start-basic
Your Example Website or App
https://github.com/tanstack/router/tree/main/examples/react/start-basic
Steps to Reproduce:
Clone repo https://github.com/tanstack/router/tree/main/examples/react/start-basic
Add CSS Modules support by creating a .module.css file and importing it into a React component.
Run the server and open the app in a browser.
Observe that the styles are applied only after the client-side hydration, causing a flash of unstyled content (FOUC).
Expected behavior:
I would like to see a working example or documentation on how to properly configure TanStack Router with CSS Modules and SSR.
The desired behavior is to have styles included in the server-rendered HTML, so there is no flash of unstyled content (FOUC).
1 Reply
rare-sapphire•9mo ago
#start-questions