Vue · Routing
vite-doctor/vueroutingerrorSuggestion
Why it happens
vue-router follows record redirects without a limit, so a cycle of static redirects never resolves and navigation to any member hangs or overflows the stack.
Fix
Point one record in the cycle at a route that renders a component, or remove the redundant redirect.
Example
End the redirect chain at a page
Before
createRouter({
history: createWebHistory(),
routes: [
{ path: '/old', redirect: '/new' },
{ path: '/new', redirect: '/old' },
],
})
After
createRouter({
history: createWebHistory(),
routes: [
{ path: '/old', redirect: '/new' },
{ path: '/new', component: NewPage },
],
})
Verify the fix
Run only this rule after editing so the report stays focused on the diagnostic you are closing:
pnpm vite-doctor . --framework vue --rules vue/router/no-redirect-cycle