-
-
Notifications
You must be signed in to change notification settings - Fork 124
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
fix: No styles in client components in PRD #658
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than that it looks good.
const cssStr = cssAssets | ||
.map((asset) => `<link rel="stylesheet" href="${asset}">`) | ||
.join('\n'); | ||
// HACK is this too naive to inject style code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wish we could inject it in rscIndexPlugin
for both server & client styles.
(hmm, we might consider about re-architecture at some point, for code-splitting styles, and (vite) plugins too.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, we haveto do code-splitting at some point! Shall I now work on it and get it working with rscIndexPlugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I now work on it and get it working with rscIndexPlugin?
Is it possible for the current architecture?
It would be nice if there's a less-hacky way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I'll try my best, I'll get back to you soon!
But if we want to do a release, I think let's merge it and tackle it later (maybe in the re-arch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(re-arch won't be soon.)
Yeah, if there's a better way, we would like to have it now. I plan to merge it next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took a look, the emitted css files are emitted in the client bundle phase which is the last phase, while rscIndexPlugin happens at the same time or even before in the buildSsrBundle phase.
I don't know if it's possible to bring the client bundle before ssr! But it's not ideal anyway. Wdyt? maybe we should skip it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it may require one more viteBuild step, which is not very good because it will make it slower.
I think the best is to send <link>
tag in the RSC payload. But, it will require new technique (it's more work and different from re-arch I said above. It's more related with code-splitting.)
Thanks for your investigation. Let's merge this for now.
Partially resolves #651