Closed ddcovery closed 2 years ago
Found the example in repository (https://github.com/mefechoel/svelte-navigator/tree/main/example/custom-hash-history) solving the problem.
It requires a custom history source (createHashSource
) that, may be, could be provided directly by svelte-navigator
component :-)
Exactly, there is no official support for this, because the described solution does not work correctly with server side rendering. If you inspect the links, created using svelte navigator, you'll see that their href does not start with a #
but with a /
. The spa navigation still works, because the clicks to the links are intercepted, but when there is no js running (i.e. when the htnl is server generated), the links would lead to the wrong place (/my/page
instead of #/my/page
). Fixing this isn't that involved, but would require potentially breaking changes to the history interface, so I won't do that for now. That would be something for a version 4.0...
Is your feature request related to a problem? Please describe. A clear and When user tries to reload the page, server responds with a 404 because it knows nothing about client-side routes
The only solution I have now is to define all client-side routes as server-side static routes pointing to the "public" root folder
Describe the solution you'd like A clear and concise description of what you
May be it is solved, but I'm not finding examples or documentation about it
What I need is URLs based on #/ like this
instead this