SPA mode when deployed with SST
Has anyone used tanstack start in SPA mode when deployed in SST?
I have tried to deploy with
spa: { enabled: true } but the deployment hangs after Client and Server bundles for TanStack Start have been successfully built.
Also I have tried to disable prerender but it is still attempting to prerender the shell
I have a loader on my / route which I want to be run on the client, but not when creating the SPA shell. Should I just do
or something along them lines?9 Replies
national-gold•3mo ago
SPA mode needs the shell to be prerendered
I have a loader on my / routedo you mean the __root route? or the /index route
broad-brownOP•3mo ago
Ahh I see so it just prerenders the
routes/__root.tsx, not routes/index.tsx ?
I currently have a loader on both but I think with it running in SPA mode I can remove the one on __rootnational-gold•3mo ago
it also renders /index
but it does not use that data in the shell
you can set a different mask path for prerendering the shell
broad-brownOP•3mo ago
@Manuel Schiller my understanding was that in SPA mode the server would only be used for server functions/api routes. Is this incorrect? I'm looking in the
.output/server file and I can see that there is react code in there.
I'm wanting to try and keep the server as small as possible so that when it is deployed to a lambda it will be as fast as possible.national-gold•3mo ago
this is correct, there is no server rendering at runtime
the build just does not respect that yet
can you please create a github issue for this so we can track this properly?
broad-brownOP•3mo ago
Ahh sweet. Yeah will do! Thanks for your help
broad-brownOP•3mo ago
GitHub
SPA mode server build contains unnecessary SSR code · Issue #5059 ...
Which project does this relate to? Start Describe the bug When running tanstack start in SPA mode, the server build contains SSR code. Your Example Website or App Steps to Reproduce the Bug or Issu...
conscious-sapphire•3mo ago
can we make this configurable actually
like it would be great if we can support creating a _shell file while still having SSR
it's perfect for my use-case of SSR -> SPA via a service worker
national-gold•3mo ago
could be done yes