Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vercel support #232

Open
Netwyn opened this issue Sep 11, 2022 · 3 comments
Open

Vercel support #232

Netwyn opened this issue Sep 11, 2022 · 3 comments

Comments

@Netwyn
Copy link

Netwyn commented Sep 11, 2022

Is there a way I can integrate this with Vercel? I don't want to use SvelteKit as the website I want to publish onto Vercel is static and quite literally doesn't have a backend. I use the Svelte + Vite template, with JavaScript. Running the site locally via npm run dev works fine, and the site is fully functional, but Vercel doesn't allow me to use any form of routing; I get a 404 page on any subdirectory that would typically run perfectly fine locally.
i.e., app.vercel.app works perfectly fine, but app.vercel.app/{something} results in a 404. I use anchor tags in my HTML for redirects, and I use the Router component in App.svelte

@Joshswooft
Copy link

Also having this issue, I've tried to do a similar fix which worked for react routing here: https://stackoverflow.com/questions/64815012/why-does-react-router-not-works-at-vercel

e.g.

vercel.json in root of repo.

{
  "rewrites": [{ "source": "/(.*)", "destination": "/" }]
}

@JohnJasonFisher
Copy link

JohnJasonFisher commented Nov 3, 2022

I copy pasted that vercel.json @Joshswooft mentioned into my svelte SPA app hosted on Vercel and that did the trick for me!

I wish this info was in a doc somewhere.

@JohnJasonFisher
Copy link

ho

So update on this, the vercel.json works great in prod but now in dev and preview it cannot find the client and main.js files. Will update as I learn more.

Screenshot 2022-11-04 at 12 46 54 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants