Search code examples
reactjstypescriptvitevercel

404 error when deploying react app in Vercel


I deploy a react, typescript project using Vite. Veployed app working fine but while refreshing a page getting a 404 error.

404: NOT_FOUND
Code: NOT_FOUND

Solution

  • Add this to your vercel.json file. Then push or deploy to vercel again.

    {
      "routes": [
        { "handle": "filesystem" },
        { "src": "/.*", "dest": "/index.html" }
      ]
    }