I've noticed styles are not rendered on the server and are only rendered once the client app starts, causing a brief flash of unstyled content. When I looked at build/assets.json
, the css
key was missing after running yarn start
, but is present after running yarn build
. If it's intentional to extract the styles only for a production build, I'm trying to understand how the styles can be rendered prior to the client app starting and preventing the FOUC.
This only happens during development. There is no FOUC when run in production. If this is problematic, I suggest extending razzle to use extract text webpack plugin to pull out style sheets during dev just as they are pulled in razzle-build. I am not sure that HMR will work the way you expect if you make this change
I am using styled components(CSSinJS) for my styling and am facing this problem in production too.
@corydeppen Hello. Have you solved this problem?
Most helpful comment
This only happens during development. There is no FOUC when run in production. If this is problematic, I suggest extending razzle to use extract text webpack plugin to pull out style sheets during dev just as they are pulled in razzle-build. I am not sure that HMR will work the way you expect if you make this change