T
TanStack3mo ago
fascinating-indigo

Netlify dev fails when including a spa redirect

My project is a tanstack router react app with vite. In the netlify docs it mentions spa apps require a redirect from /* to index here adding this redirect isnt an issue until you do a local build either with pnpm build, or using the Netlify cli with
netlify build
netlify build
. after building the project the
netlify dev
netlify dev
command crashes the server immediately and the only way to fix it is to delete the
dist
dist
folder. this doesnt effect production builds only local development i have a minimum reproducible example here as netlify and tanstack are offical partners i thought someone here would have a solution
GitHub
GitHub - AlexanderIsom/netlify-spa-routing-MRE: a MRE of a spa issu...
a MRE of a spa issue for the netlify cli local dev server - AlexanderIsom/netlify-spa-routing-MRE
Rewrites and proxies
Use rewrite rules to fetch a location behind the scenes while the URL in the visitor’s address bar remains the same. Proxy to another service or site.
2 Replies
correct-apricot
correct-apricot3mo ago
cc @Netlify (Partner)
xenial-black
xenial-black3mo ago
Thank you for the great bug report @AlexNotTheLion! We'll take a look as soon as we can.

Did you find this page helpful?