You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This isn't super scientific but gives some anecdotal evidence that it's worth at least experimenting with:
It also seems like a more scoped project than adopting RSC in a framework because Docusaurus is already constrained (always static output, no complex layouts).
Would love to hear your thoughts (and also happy to answer any integration questions).
Reacted by Akane, Martin Helmich, Alex Birdsall, Fatih Altinok and Tom Conroy
Reacted by TheCatLady, thedevwonder, Alvar Lagerlöf, 陈杨文, Akane and Tom Conroy
Actually, I've been thinking about this a lot and definitely want to add RSC support in Docusaurus for various reasons.
One of them is of course to reduce the bundle size, hydration time (particularly on long MDX content that's often quite static) and improve Lighthouse/CWV metrics.
There are also opportunities to use RSC to use more convenient tooling to interleave heavy runtime libs without paying the cost in the bundle. I'm thinking of:
What I'm most excited about is the flexibility it allows for Docusaurus Server/Static Components to query a data lake. We currently don't have a data layer like Gatsby, so the blog data is kind of only available on the /blog/* routes. With RSC we could query a big object DB and easily inject things like the 3 latest blog posts on your landing page.
Somehow it would allow the same as GraphQL for Gatsby, but we'd only use TypeScript instead and just pick the data we want for each page through the Server Components.
Today I'm still in the process of upgrading to MDX 2 (#8288) and will upgrade to React 18 just after 😅 Also apart from looking at Next.js I'm not sure yet how to integrate RSCs in Docusaurus, is there any example of vanilla RSC integration out there?
Reacted by Chris McGrath, Lucas Rosa and Tom Conroy
Hey there! RSC seems like a solid way to boost performance. It’d be awesome to have this available for both pages and custom plugins. Could you share an update on where things stand with this feature now?
Hey there! RSC seems like a solid way to boost performance. It’d be awesome to have this available for both pages and custom plugins. Could you share an update on where things stand with this feature now?
But we are in the process of migrating to Rspack (#10402) and made good progress on that, it should be released as experimental in v3.6 as a replacement for Webpack building 3x faster.
Adopting Rspack is an important step because adopting RSCs under Webpack might also slow down the build, which was already quite slow. Rspack (and other modern module bundlers) now have the ability to build the same app in multiple variants (Node, Client, RSC...) in a single pass instead of using Webpack MultiCompiler:
So, the first step is successfully adopting Rspack. Then we'll work on RSC support. But it's likely to take some time and require significant refactor of how our theme is organized. Some of our theme components will have to become RSCs for example, while others will use "use client". Most likely we'll refactor this progressively and start by adding "use client" everywhere to release RSC support sooner.
Thanks :) We'll look into this after Docusaurus v4 is out, and see if we can have an RSC-based version for Docusaurus v5.
I guess it could also be easier to add RSC support if we first drop support for Webpack, which we'll still support in v4, right? Or do you think Webpack/Rspack abstractions are similar enough to make it relatively easy to support both bundlers?
Is it possible to only have 2 entries? IMHO since we are an SSG, we don't really need the same setup as frameworks that support SSR, and maybe we don't need 2 layers for SSR/RSC?. Does it make sense? I wonder what Rspress is doing BTW.
I guess it could also be easier to add RSC support if we first drop support for Webpack, which we'll still support in v4, right? Or do you think Webpack/Rspack abstractions are similar enough to make it relatively easy to support both bundlers?
Regarding Webpack: Rspack's current RSC solution does not support Webpack out of the box. If we wanted to support RSC in Webpack as well, we would essentially have to build the integration for Webpack from scratch. So yes, dropping Webpack first would definitely make adopting RSC much easier.
Is it possible to only have 2 entries?
To support RSC builds, Rspack fundamentally needs to spin up two separate Compilers: one to build the server-side artifacts (for Node execution) and another to build the client-side artifacts (for browser execution). Because of this underlying architecture, Rspack requires a minimum of two entries—one for the Server Compiler and one for the Client Compiler.
IMHO since we are an SSG, we don't really need the same setup as frameworks that support SSR, and maybe we don't need 2 layers for SSR/RSC?. Does it make sense?
Even in an SSG context, the two layers setup is still necessary during the build step.
Here is why: within the Server Compiler, the process of executing React Components -> RSC payload relies specifically on the React react-server runtime. However, the subsequent step of rendering that RSC payload -> HTML String relies on the default React runtime. To handle both of these steps correctly within the same build process, we have to configure different resolve conditions, which requires separating them into two distinct layers.
We already have 2 entries (client/brower + node/server/ssg). I thought that we needed to build our app in 3 variants to support RSC, and that seemed overkill for SSG.
Second, a single application now needs to handle multiple bundles. At the end of 2020, React Server Components were announced: to use React Server Components, you will need a bundle for RSC, separate from the client bundle for the browser and the SSR bundle for doing SSR. This means that up to three different bundles need to be handled.
From what I understand, it's possible to separate the SSR server and the RSC flight server, eventually host them in different places too, but it's not mandatory. In your example it seems that the "server" app handles both ssr/rsc and a single server can handle requests for both.
Activity
slorber commentedon Jun 21, 2023
My initial answer:
Hey 👋
Actually, I've been thinking about this a lot and definitely want to add RSC support in Docusaurus for various reasons.
One of them is of course to reduce the bundle size, hydration time (particularly on long MDX content that's often quite static) and improve Lighthouse/CWV metrics.
There are also opportunities to use RSC to use more convenient tooling to interleave heavy runtime libs without paying the cost in the bundle. I'm thinking of:
Some related tweets:
What I'm most excited about is the flexibility it allows for Docusaurus Server/Static Components to query a data lake. We currently don't have a data layer like Gatsby, so the blog data is kind of only available on the
/blog/*routes. With RSC we could query a big object DB and easily inject things like the 3 latest blog posts on your landing page.Somehow it would allow the same as GraphQL for Gatsby, but we'd only use TypeScript instead and just pick the data we want for each page through the Server Components.
Today I'm still in the process of upgrading to MDX 2 (#8288) and will upgrade to React 18 just after 😅 Also apart from looking at Next.js I'm not sure yet how to integrate RSCs in Docusaurus, is there any example of vanilla RSC integration out there?
thedevwonder commentedon Jun 30, 2023
This looks like a good thing for experimentation. I don't have much experience on server-side react but would definitely like to try it out!
usulpro commentedon Oct 2, 2024
Hey there! RSC seems like a solid way to boost performance. It’d be awesome to have this available for both pages and custom plugins. Could you share an update on where things stand with this feature now?
slorber commentedon Oct 2, 2024
@usulpro the work on RSC hasn't started yet.
But we are in the process of migrating to Rspack (#10402) and made good progress on that, it should be released as experimental in v3.6 as a replacement for Webpack building 3x faster.
Adopting Rspack is an important step because adopting RSCs under Webpack might also slow down the build, which was already quite slow. Rspack (and other modern module bundlers) now have the ability to build the same app in multiple variants (Node, Client, RSC...) in a single pass instead of using Webpack MultiCompiler:
https://rspack.dev/blog/announcing-1-0#react-server-components-support
So, the first step is successfully adopting Rspack. Then we'll work on RSC support. But it's likely to take some time and require significant refactor of how our theme is organized. Some of our theme components will have to become RSCs for example, while others will use
"use client". Most likely we'll refactor this progressively and start by adding"use client"everywhere to release RSC support sooner.SyMind commentedon Mar 27, 2026
Hi @slorber, Rspack now has built-in RSC capabilities: https://v2.rspack.rs/guide/tech/rsc
You can find usage examples here: https://github.com/rstackjs/rspack-rsc-examples
If needed, I'd be happy to provide any help with the RSC integration.
slorber commentedon Mar 30, 2026
Thanks :) We'll look into this after Docusaurus v4 is out, and see if we can have an RSC-based version for Docusaurus v5.
I guess it could also be easier to add RSC support if we first drop support for Webpack, which we'll still support in v4, right? Or do you think Webpack/Rspack abstractions are similar enough to make it relatively easy to support both bundlers?
Is it possible to only have 2 entries? IMHO since we are an SSG, we don't really need the same setup as frameworks that support SSR, and maybe we don't need 2 layers for SSR/RSC?. Does it make sense? I wonder what Rspress is doing BTW.
SyMind commentedon Mar 31, 2026
Regarding Webpack: Rspack's current RSC solution does not support Webpack out of the box. If we wanted to support RSC in Webpack as well, we would essentially have to build the integration for Webpack from scratch. So yes, dropping Webpack first would definitely make adopting RSC much easier.
To support RSC builds, Rspack fundamentally needs to spin up two separate Compilers: one to build the server-side artifacts (for Node execution) and another to build the client-side artifacts (for browser execution). Because of this underlying architecture, Rspack requires a minimum of two entries—one for the Server Compiler and one for the Client Compiler.
Even in an SSG context, the two layers setup is still necessary during the build step.
Here is why: within the Server Compiler, the process of executing React Components -> RSC payload relies specifically on the React react-server runtime. However, the subsequent step of rendering that RSC payload -> HTML String relies on the default React runtime. To handle both of these steps correctly within the same build process, we have to configure different resolve conditions, which requires separating them into two distinct layers.
slorber commentedon Mar 31, 2026
Thanks, I understand
We already have 2 entries (client/brower + node/server/ssg). I thought that we needed to build our app in 3 variants to support RSC, and that seemed overkill for SSG.
https://green.sapphi.red/blog/increasing-vites-potential-with-the-environment-api
From what I understand, it's possible to separate the SSR server and the RSC flight server, eventually host them in different places too, but it's not mandatory. In your example it seems that the "server" app handles both ssr/rsc and a single server can handle requests for both.