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
Deploying vite frontend and express backed
Cheapest and easiest way to deploy a simple Vite React app?
Deploying on Vercel with React + Vite
Videos
I have a very simple Vite React app with no database (it uses Supabase). What's the easiest and possibly cheapest way of deploying it? Note that this is for demonstration purposes only, so I don't expect much traffic (if any at all).
Hey folks, I am having an intermittent issue when i go to my website that seems to be vercel react issue.
Uncaught SyntaxError: Unexpected token '<' -- seeing this in console
Overall the site works on other peoples computers just seems to not work in prod on mine unless i clear catch.
If I clear clear site data it goes away but seems to come back after a day.
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.