This is a common issue with SPAs which occurs while working with child paths/routes. This is not specific to vercel and even occurs on other platforms as well, Here is something you can try with vercel:
Create a vercel.json file within the root folder of your project. Add this config to the file:
{
"rewrites": [
{ "source": "/(.*)", "destination": "/" }
]
}
As mentioned in this doc as well:
Answer from Chinz on Stack Overflow"rewrites" specifies the rules for URL rewrites.
{ "source": "/(.*)", "destination": "/" }tells Vercel that for any URL path that matches/(.*)(essentially any path), redirect the request to the root path (/).
reactjs - Why i'm not able to deploy my vite app on vercel - Stack Overflow
express - How to deploy a Vite + React SSR application on Vercel? - Stack Overflow
Can I host a React + Vite + TypeScript project on Vercel’s free plan? Also looking for a free backend option
React app i created using vite has refused to deploy despite it working fine on local host and run build
Videos
Hi everyone 👋,
I have a frontend project built with React + Vite + TypeScript, and I’d like to host it on Vercel.Does Vercel support deploying this kind of setup on the free plan?
If yes, what are the main limitations (like build time, bandwidth, or request limits)?
If not, what are the best free alternatives for hosting Vite projects — such as Netlify, GitHub Pages, or Cloudflare Pages — and do they require any special configuration for Vite?
Additionally, I need a free backend to pair with my frontend.
What are the recommended free backend options that work well with Vercel or Vite projects?
For example:
• Using Serverless Functions on Vercel • Hosting Express.js on Render or Railway • Or using a BaaS solution like Supabase or Firebase
Any advice or experience would be greatly appreciated 🙏
Hey everyone 👋
I’m currently working on a frontend project built with React + Vite + TypeScript.
I’ve read the Vercel docs and noticed that Vercel mainly focuses on Next.js, but I’m wondering if there’s an official or recommended way to deploy Vite-based projects there, especially on the free plan.
Here’s what I’ve tried so far:
• Built the project using npm run build — everything works fine. • The output is in the /dist folder (default for Vite). • I saw some mentions that it’s possible to host it on Vercel with static export, but I’m not sure about the right configuration for routing and environment variables.
My questions:
1. Does Vercel free plan fully support React + Vite projects? 2. Are there any limitations (build time, bandwidth, or file size)? 3. If Vercel isn’t ideal, what’s the best free alternative (Netlify, GitHub Pages, Cloudflare Pages, etc.) for Vite apps? 4. Also, I’ll need a simple free backend — would you recommend something like Render, Railway, or Supabase for small APIs?
Thanks in advance! 🙏 I’d really appreciate any guidance or setup examples.