-
Notifications
You must be signed in to change notification settings - Fork 42
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
URL set to /404.html even though routing works #116
Comments
Hi @plasmatech8 You don't need these lines: https://github.com/plasmatech8/svelte-practice/blob/main/06_svelte-spa-router_examples/basic-routing-using-svelte-router-spa-instead/src/routes.js#L17-L20 Named params are optional so a route like: '/wild/:card' will serve both /wild and /wild/some-info Also in line 14 https://github.com/plasmatech8/svelte-practice/blob/main/06_svelte-spa-router_examples/basic-routing-using-svelte-router-spa-instead/src/routes.js#L14 As all named params are optional by default there is no need to use ? To be more specific: A route like this one https://github.com/plasmatech8/svelte-practice/blob/main/06_svelte-spa-router_examples/basic-routing-using-svelte-router-spa-instead/src/routes.js#L13-L16 will serve all this urls:
Hope that helps. |
@jorgegorka thanks for the comment :) I am still not sure why it is changing the path to Perhaps something to do with Vite. Or an issue with how the router handles anchor tags / routing. Not sure.
|
I haven't tried Vite yet
You need to add the router at the very beginning of your application otherwise it would be unable to route urls correctly. If you have something like:
Then Header, Sidebar and Footer will know nothing about routes. They should all be rendered in a template inside In this application you can see an example with plenty of routes: https://github.com/jorgegorka/demanda/blob/master/frontend/src/App.svelte |
I was trying out some Svelte routers.
I decided to try testing the Vite Svelte template using the sample project from the
svelte-spa-router
repo (a different router).Then I tried converting this example project from
svelte-spa-router
tosvelte-router-spa
.The result is:
svelte-spa-router
svelte-router-spa
However, URL path keeps getting set to
/404.html
. Any ideas why?The text was updated successfully, but these errors were encountered: