`router.mode.hash()` broken?
See original GitHub issueHello! New user here, so I may very well be getting something wrong.
I tried setting the router mode like this (in my index.html before I load the Svelte app):
<script type="module">
import {router} from "tinro"
router.mode.hash()
</script>
And alternatively like this (inside my .svelte app file):
<script context="module">
import {router} from "tinro"
router.mode.hash()
</script>
But while I can confirm that the code runs in either location… an <a href="/foo/">
still uses the History API to change the location to point to a non-existent page (/foo/
). (I expected something like /myapp/#/foo/
.)
The Route does work and display properly in my window, but if I reload the page the URL doesn’t work because I don’t have (and don’t want) server-side support for wrong URLs.
[Update]: There are also no errors in the console. I’m running FireFox 84.0.1.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Hash in history mode router, breaks dynamic URL in Vue
14, Vue Router set to history mode, URL containing a hashtag "#" breaks dynamic path. const router = new VueRouter({ base: `${process.env.
Read more >Hash in history mode router, breaks URL : r/vuejs - Reddit
Using Vue 2.6.14, Vue Router set to history mode, URL containing a hashtag "#" breaks dynamic path. const router = new VueRouter({ base…...
Read more >Different History modes - Vue Router
The history option when creating the router instance allows us to choose among different history modes. Hash Mode #. The hash history mode...
Read more >Angular Router: Child Routes, Auxiliary Routes, Master Detail
This is opposed to the ancient routing were the browser address bar would display /#/lessons instead. Why this problem does not occur using...
Read more >Fixing the 'cannot GET /URL' error on refresh with React ...
Along the way, you'll also learn how client side routers work. ... Your whole app breaks on refresh and all you get is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Heh… There was my mistake in modules bundling -
router
which usedRoute
component androuter
which you imported was two different things, so nothing happening when you changed mode.Module is using in REPL. But some Svelte templates also load module (
"main"
or"module"
field inpackage.json
) insteadRoute.svelte
. I recomend to avoid such templates, because it will dublicate svelte code in your bundle.Huh! 0.5.5 works! I’m not sure how those changes fixed it, but I confirmed that if I switch back to 0.5.3, links do not insert the
#
, and if I switch back to 0.5.5, they do. 🎉 Thanks!I’m still having the issue above with the browser back button, but I’ll open a separate issue for that.