npm / vue-router
vue-router
What changed in vue-router 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
11 breaking1 security5 deprecations19 new APIs and options2 performance10 behavior and defaults7 tooling52 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initvue-router 5103 changes
Breaking changes 11
Experimental hash handling no longer decodes the hash and only protects encoding.
Experimental query params cannot be both required and have a default.
Experimental query values are normalized to arrays, changing the shape developers receive when reading query values.
Experimental redirects no longer inherit params, query, or hash.
The type for a definePage param default is stricter.
The experimental miss() now throws internally and returns never.
The experimental selectNavigationResult API is removed.
The package uses type module.
Devtools are removed from the IIFE build.
Missing param parsers now produce a runtime error.
The IIFE build no longer includes @vue/devtools-api because its upgraded v8 does not expose an IIFE build.
Security 1
Query objects use Object.create(null) to prevent prototype pollution.
Deprecations 5
Warns about removal of legacy optional params.
The discarded params warning now hints at the
params: {}workaround.NavigationResult is deprecated in favor of reroute(to).
Using the next() callback in navigation guards now triggers a deprecation warning.
Experimental resolver warns against non-absolute aliases.
New APIs and options 17
createRouter accepts a prebuilt matcher.
Experimental definePage can extract hash params.
Experimental definePage allows custom regular expressions for path params.
Experimental support lets developers configure required and default hash params.
Adds onRouteRendered.
Adds UseScrollRestoration for scroll restoration.
The useRouter() return type can be overridden through the experimental types config.
Raw param parsers can be forced to have an array type.
Repeatable params are supported in subsegments as an experimental feature.
Param parsers now support include and exclude options.
Standard schema param parsers are now supported.
Nested folders support _parent; conflicts warn, and _parent is non-matchable by default.
Adds experimental reroute() as the replacement for NavigationResult.
Data loaders are added as an experimental feature.
resolveOptions is exposed for unplugin integrations.
The Volar plugin allows configuring rootDir.
A route JSON schema is added.
Performance 2
Resolves absolute locations without depending on the current route.
Avoids tracking currentRoute for absolute string locations.
Behavior and default changes 10
Hashes and the top position are restored by default.
Skips scroll computation based on history.scrollRestoration.
The global Router type can be overridden.
defineParamParser() was made more intuitive.
Aliases are displayed in logs.
Experimental resolvers now handle aliasOf.
Aliases are extracted from definePage.
Experimental resolvers generate aliases from overrides.
Warns when routes have conflicting components.
Query params are optional by default.
Tooling 7
Narrows typeof useRoute in a type context.
Adds helpful diagnostics for developers.
The params.path value in definePage is typed.
Vite is added as an optional peer dependency for types.
Automatic types are added for param parsers.
unplugin-vue-router is merged into the core package, so developers can upgrade to Vue Router 5 instead of using it as a separate package.
Volar plugins are added for use with Vue Router.
Fixes and other changes 50
Sanitizes the named view in a definePage import.
Experimental guard redirects during history navigation are resolved against the navigation target.
Experimental hash parameter parsing is aligned with query parsing.
Experimental hash params can be optional and nullable.
Duplicate hash params keep the last value instead of throwing.
Keeps the declared case of a static prefix when building a matcher pattern path.
Keeps hexadecimal character codes in parameter-segment regular expressions.
Experimental query params with defaults are optional when pushing a route.
Hash params with defaults are excluded from the required set.
Obsolete scroll positions are invalidated.
Handles non-string params for isActive.
Prevents a race condition that caused a dev-only error.
Allows unsetting a route name with false.
Generated parameter types are sorted and deduplicated.
Unnamed parameters are omitted from generated route types.
Generates parameter types from override paths and stops inheritance on absolute overrides.
Skips saving scroll position when the pop direction is unknown.
Reports unnamed parameters once per route.
Removes the listener to prevent focus stealing in Edge.
Vue Router now allows Pinia 4.
Ignores stale asynchronous scrollBehavior results.
Rejects invalid hex digits in [x+hh] character codes.
Invalid query params are filtered without causing route matching to fail.
Undefined values are allowed for params in query.
definePage path-param parser overrides are now applied.
Param tokens are finalized before an escaped colon is processed.
The unplugin no longer generates empty routes.
Resolved params omit empty optional params.
RouteNamedMap is wired through generated routes.d.ts.
Fixes a missing closing quote in a generated import.
Tracking definePage imports per-file fixes a named view race condition.
Hashes on string locations are no longer decoded twice.
Allows pushing to auto routes.
Restores context across sequential awaits in loaders.
Prevents false duplicate route warnings for named views.
Avoids iterator helpers for Node 20 compatibility.
Escapes backslashes in string literals.
Auto-routes no longer include non-matchable routes.
Nested groups are handled correctly.
_parent.vue files no longer have a name.
Route ordering is stable for group folders with the same path and corrected for group nodes with inflated scores.
Old route overrides are cleaned up.
The RouteMapGeneric constraint is relaxed for interface-based RouteNamedMap.
Fixes handling of empty options in Volar.
The vue-router version check is loosened.
Typed plugins now work with vue-tsc.
Navigation guards are triggered when a keep-alive component is reactivated for a different route.
A fix avoids breaking support for older browsers.
Param parsers work when the declaration file is not at the root.
Tildes in paths are escaped.
vue-router 44 changes
New APIs and options 2
Experimental basic alias support was added.
Experimental support was added for handling redirect types.
Fixes and other changes 2
The build output was made compatible with v4.5.
Experimental isActive handling was fixed for custom params.