rsbuild-plugin-react-router icon indicating copy to clipboard operation
rsbuild-plugin-react-router copied to clipboard

Building with `ssr: false` doesn't seem to work

Open dangmai opened this issue 1 year ago • 2 comments

Thank you for this very useful plugin.

When I try to build a project with ssr: false, RSbuild still builds both client and server, and the client files don't seem to work on their own.

Here's a reproducible repo: https://github.com/dangmai/rr7-spa-rsbuild

There are 2 packages within it, one with Vite and one with RSbuild. Both are building the same project files, both with ssr: false in react-router-config.ts.

After the build, the Vite project contains a build/client directory with a clear index.html that can be deployed. Meanwhile, the RSbuild project contains both build/server and build/client, and the files in build/client don't seem to work on their own in the browser.

dangmai avatar Apr 12 '25 00:04 dangmai

After some more research, I believe it's because RR7 in SPA Mode still requires to server render the root route, which is then read by the Vite plugin and flushed to disk as index.html. The implementation of that process starts here: https://github.com/remix-run/react-router/blob/2ac4f9b231d83ee391b94160021397161e5e586d/packages/react-router-dev/vite/plugin.ts#L1743

dangmai avatar Apr 14 '25 22:04 dangmai

Hey folks! Is there any update on this one? Thanks!!

raffaele-abramini avatar Jun 04 '25 08:06 raffaele-abramini