Uh oh!
There was an error while loading. Please reload this page.
feat(nuxt): router with hash mode - #6980
Conversation
✅ Deploy Preview for nuxt3-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
pranavxc
commented
Aug 29, 2022
Thanks for the PR, we have been struggling due to the issue since last week. As a workaround we have updated the build files under node_modules directly ( For enabling hash-based routing we had modified import{createRouter,createWebHistory,createMemoryHistory}from"vue-router";to import{createRouter,createWebHashHistoryascreateWebHistory,createMemoryHistory}from"vue-router";And fixed following issue mentioned in PR
by changing following functioncreateCurrentLocation(base,location){const{ pathname, search, hash }=location;to functioncreateCurrentLocation(base,location){const{ pathname, search, hash }=newURL((location.hash||'').replace(/^#/,''),location.origin);As a temporary workaround it's working 👍 waiting for your PR to merge. |
bcakmakoglu
commented
Aug 29, 2022
@pi0 is there something we could potentially help with to get this PR merged quicker? 😄 |
pi0
commented
Aug 29, 2022
WoW I didn't expect this amount of welcoming for this particular feature <3 Surely we can move it to the edge. Only there is an issue that redirects to |
🔗 Linked issue
nuxt/nuxt#13821
❓ Type of change
📚 Description
This PR adds support for hash history mode for router (client only) with a new option. In order to enable:
Remarks:
createWebHashHistoryis super simple. It basically appends#to the base with location.host and reusecreateWebHistory. So there is almost no bundle overhead for this optionrouter.optionstoapp.routerthis way option would be simplerapp.router.hashMode: falseinstead ofrouter.options.hashMode: false.router.modefrom Nuxt 2 is also deprecated. We could portal it but it makes it harder to merge with one options object.TODO:
/#each timessr: falsewithhashMode: true