-
-
Notifications
You must be signed in to change notification settings - Fork 125
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
styles are not applied correctly with stylex
in server components
#750
Comments
@dai-shi The plugin that I use is the same ( |
Exactly... Then, I think @nonzzz can help here? |
I get lots of random errors on startup with stylex too. If you run start on my project twice though it does work. builds are fine. Can share the project if you want |
Let me check it. |
@emilgpa Did you add |
@hipstersmoothie If you have any problem. Share your project in my plugin repo, i have time to check it.Thanks. |
@nonzzz Ok, it works. I added it in the root-layout.tsx. I thought it is only needed in that entry file. Anyway, I have the same problem in a project that is larger even though it includes that import. I think I'll need to include this import in all files where stylex is used and maybe that will fix it. I'll try. If it is not solved, I will try to see what it could be and upload a repo again to reproduce it. Thank you. |
@nonzzz I put that in my _layout and it works a lot better now! No weird react errors anymore. You should really add that to the docs 😄 |
@nonzzz After to apply the
Many files are being compiled and loaded and meanwhile the browser with vite displays the components. In this part precisely, is when the server components are shown alternating their version with the styles applied or not, to finally show them correctly applied or not. Currently, as I mentioned at the beginning, most of the time they display correctly but a few times it fails, so I reload and they display correctly again. It seems like something like a race condition. |
I think a lot of that could be fixed with better caching nonzzz/vite-plugin-stylex#28 |
I just noticed running |
Yeah that problem is pretty bad and pollutes the log a log. I think what's going on is it creates a virtual module |
@nonzzz Are you still around? There might be some updates in the Waku core part. Can you look into it? |
Using stylex with https://github.com/nonzzz/vite-plugin-stylex not apply correctly the styles when the component is a server component. It is applied correctly when the component is a client component. I don't know where the error comes from, if it is from waku or from the plugin. If it is from the plugin then I would open a issue there.
I leave a repo to reproduce it: https://stackblitz.com/edit/vitejs-vite-gj5y4r.
The
Logotype
component should render with blue color but it is black when the server is running first time. If you save a random file like templates/root-layout.tsx then theLogotype
component is correctly displays in blue. It happens only in dev mode, when the repository is built and started (waku build
,waku start
) everything works.The text was updated successfully, but these errors were encountered: