redirect via navigateTo() not working with nuxt generate
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v16.14.2
- Nuxt Version:
3.0.0-rc.6
- Package Manager:
npm@7.17.0
- Builder:
vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
Reproduction
https://stackblitz.com/edit/nuxt-starter-zaokyb?file=pages/index.vue
Describe the bug
having a page redirect to another page via the navigateTo
helper does not work with nuxt generate
.
e.g.
<script setup lang="ts">
await navigateTo('/target', { replace: true })
</script>
gets rendered as a white page with the text Redirecting to /target
.
see attached stackblitz-project for an example.
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Navigate to nuxt error page via client side? - Stack Overflow
In your catch you can redirect user to error page by return this.$nuxt.error({ statusCode: 404, message: 'err message' }).
Read more >navigateTo · Nuxt Utils
navigateTo redirects to the given path and sets the redirect code to 302 Found by default when the redirection takes place on the...
Read more >Nuxt Redirects in 4 Steps - Medium
Nuxt Redirects in 4 Steps ... Nuxt uses automatic routing. Nuxt automatically transforms the “pages” folder into basic routes. Therefore, if you create...
Read more >The router Property - Nuxt
If you want to have a redirect to router.base , you can do so using a Hook, see Redirect to router.base when not...
Read more >Creating Redirects With Nuxt - Josh Deltener
Using The Nuxt Default Server. If you use Nuxt's default server you have to do a bunch of url parsing and redirecting yourself....
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
Should already be implemented in h3 and you’ll get the benefit in next h3 release 😊
Please use
npx nuxi upgrade --force
to update lockfile and have latest h3.