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 weband 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!