Description
Currently, there is the following option (mentioned in #664):
-s, --single Rewrite all not-found requests to `index.html`
However, this option is limited and does not support loading custom HTML as mentioned by @woss in:
Why
Frameworks like Tanstack Start generates _shell.html by default for SPA, rather than index.html:
Alternatives
A workaround can be seen here:
Where serve.json is created with a rewrite:
{
"rewrites": [
{
"source": "!/api/**",
"destination": "/_shell.html"
}
]
}
This isn't ideal, however, since the rewrite works on all paths rather than serving as a fallback, which masks the API route - thus, it needs to be excluded in the source glob. There may also be other exclusions needed apart from /api.
Description
Currently, there is the following option (mentioned in #664):
However, this option is limited and does not support loading custom HTML as mentioned by @woss in:
Why
Frameworks like Tanstack Start generates
_shell.htmlby default for SPA, rather thanindex.html:[RFC] SPA Mode Enhancements TanStack/router#3394
https://tanstack.com/start/v0/docs/framework/react/guide/spa-mode#how-does-it-work
Alternatives
A workaround can be seen here:
Where
serve.jsonis created with a rewrite:{ "rewrites": [ { "source": "!/api/**", "destination": "/_shell.html" } ] }This isn't ideal, however, since the rewrite works on all paths rather than serving as a fallback, which masks the API route - thus, it needs to be excluded in the source glob. There may also be other exclusions needed apart from
/api.