Open cliveportman opened 1 year ago
Please can anyone answer this
You need to add a rewrite rule when deploying to vercel. Here is an example vercel.json
on your root directory (next to package.json
)
https://vercel.com/docs/project-configuration
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/"
}
]
}
The above example will rewrite all path to your root destination, meaning every request to any path will be served by your SPA router.
Deploying to Netlify, I've always found adding
"start": "sirv public -s"
to sort out the issue of routes returning a 404. But it's not working for me with this project. Is it Vite? If so, what's the solution? Adding the same to package.json makes no difference.