Documentación offline Nuxt main

NUXTE2005

main Documentación oficial Licencia MITDescargado el 2026-08-02

En esta página

E2005#

useRoute() was called inside a route middleware (directly or via another composable). At that point the target route is not yet resolved, so useRoute() can return unexpected values; middleware receives the to and from routes as arguments instead.

Resolution#

export default defineNuxtRouteMiddleware((to, from) => {
  // use `to` / `from` instead of useRoute()
})

::read-more{to="/docs/guide/directory-structure/middleware"} ::