-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explore options to make components support SSR #35
Comments
Comment with notes, no need to read: The reason why we don't see styles on a server component, is simply because there is "no place" for the generated styles to go. We either need to make a full css file that will always be present, or bundle the styles into the component, possibly inline. What is fun here is that if you build the repo, then serve it, everything works fine, but you still see a quick flash of no style. |
Making static CSS files for components are pretty easy - We just need to generate them with a name, and then make sure the exported components through rollup has the same generated name as in the CSS. As you an see in the image below, the CSS for the components comes from a file, and not a We use generate-css.ts to create the CSS files, and also concat all created files into a We use hash-css-names.mjs to generate hashed names for the classes. We prfix them with |
The client side styling that used to happen (the flash of no style, and then style) is gone, and every style has to come from a .css file that needs to be imported. |
Description of the bug
I have been testing the components with Next.js` new App router, and have discovered some issues:
React.createContext
error.Steps To Reproduce
I created a repo with instructions on how to replicate the issues with a server and a client component:
https://github.com/Thuneer/next-ssr
Suggested resolutions
The text was updated successfully, but these errors were encountered: