Hey folks!
I have a vite+react project written in Typescript. When running the project via vite everything works as expected.
I have added the following vercel.json to support SPA navigation:
{ "$schema": "https://openapi.vercel.sh/vercel.json", "rewrites": [ { "source": "/(.*)", "destination": "/index.html" } ]}This causes an error when I try to run the app via vercel dev:
[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .html file format, or if it's an asset, add "**/*.html" to
assetsIncludein your configuration.
Gemini is utterly bamboozled as to why this doesn't work, so I figure I'd ask some real people 🙂
For added context, I would also like to host this app's serverless functions in the /api directory, which I anticipate requiring the following addition to the vercel.json:
{ "$schema": "https://openapi.vercel.sh/vercel.json", "rewrites": [ { "source": "/api/(.*)", "destination": "/api/$1" }, { "source": "/(.*)", "destination": "/index.html" } ]}However, we're not quite there yet. Any idea what I'm doing wrong?