Expo Web SPA on Vercel: 404 Error When Refreshing Internal Routes

Hi everyone,

I’m having trouble deploying an Expo Web Single Page Application (SPA) on Vercel. The app works perfectly on the root path (/), but when I refresh (F5) or directly access any internal route (e.g., /dashboard, /auth/callback), I get a 404 error. This happens both on my custom domain and on the Vercel URL.

What I’ve tried:

  • My vercel.json is in the project root and contains only this rewrite:

{
“version”: 2,
“buildCommand”: “npx expo export --platform web”,
“outputDirectory”: “dist”,
“rewrites”: [
{ “source”: “/(.*)”, “destination”: “/index.html” }
]
}

  • The build command is npx expo export --platform web and the output directory is dist.

  • The dist folder only contains index.html and static assets (no extra HTML files for routes).

  • Framework preset in the Vercel dashboard is set to “Other”.

  • No additional rewrites or redirects are configured in the dashboard.

  • No errors in the build or runtime logs.

  • I have cleared the cache, deleted and rebuilt the output directory, and redeployed multiple times.

  • The issue occurs both on the Vercel subdomain and my custom domain.

What I expect:
Refreshing or directly accessing any internal route should load the SPA and let the client-side router handle navigation, but instead I get a 404.

Has anyone successfully deployed an Expo Web SPA on Vercel and solved this routing issue?
Is there any known limitation or workaround for Expo Web static export and SPA rewrites on Vercel?

Any help, advice, or working example would be greatly appreciated!

Thanks in advance!

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

Thank you for the link!
I have already reviewed that thread and followed all the recommended steps, including:

  • Adding the global rewrite in my vercel.json (/(.*)index.html)

  • Ensuring my output directory (dist) only contains index.html and static assets

  • Setting the build command and output directory correctly in the Vercel dashboard

  • Using the “Other” framework preset

  • Clearing cache and redeploying multiple times

Despite this, I’m still getting 404 errors when refreshing or directly accessing internal routes, both on my custom domain and the Vercel URL.
If anyone has managed to get Expo Web SPA routing working on Vercel, or has any other ideas, I’d really appreciate your help!