Welcome to v5.0
Version 5.0 is a complete rewrite for Svelte 5, bringing modern runes-based reactivity, powerful new features, and significant improvements to the developer experience.
🎯 Built for Svelte 5 with Runes
The entire router has been rewritten using Svelte 5's new runes system ($state, $derived, $effect), providing better performance and more predictable reactivity.
🔄 Automatic Referrer Tracking
The router now automatically tracks where users came from, including route parameters, query strings, route names, and scroll positions.
🐛 Category-Based Debug Logging
A comprehensive logging system with 12 hierarchical categories, color-coded output, and timestamps makes debugging routing issues easier than ever.
Categories include: ROUTER, ROUTER:NAVIGATION, ROUTER:SCROLL, ROUTER:GUARDS, ROUTER:PERMISSIONS, and 7 more for comprehensive debugging.
⚠️ Global Error Handling
Catch and recover from unhandled errors automatically with configurable recovery strategies, restart loop prevention, and beautiful error UI.
🌳 Hierarchical Route Inheritance
Child routes can now automatically inherit breadcrumbs, permissions, conditions, and authorization callbacks from parent routes, reducing code duplication.
📁 Tree/Nested Route Structure
Define deeply nested routes using a tree structure instead of flat definitions, perfect for complex applications with many levels of nesting.
🔐 Enhanced Permission System
The unauthorized handling system has been redesigned to respect routing modes and support component-based display without changing URLs.
✨ Additional Improvements
goBack() Helper
Simplified navigation to previous route with automatic scroll position restoration:
Strict Parameter Replacement
Missing route parameters are now replaced with a configurable placeholder (default: "N-A") instead of being silently removed, making it easier to spot missing data:
Consistent API Naming
All Router event props now use camelCase for consistency with JavaScript conventions:
onRouteLoading(wasonrouteLoading)onRouteLoaded(wasonrouteLoaded)onConditionsFailed(wasonconditionsFailed)
Improved TypeScript Support
Enhanced type definitions with better generics support for typed route params, query strings, and navigation context.
⚡ Performance
- Lighter weight: Runes-based implementation is more efficient than stores
- Zero overhead logging: Debug logging has negligible impact when disabled
- Better tree-shaking: Improved bundle size in production builds
- Faster route matching: Optimized pattern matching with regexparam
🛠️ Developer Experience
Better Error Messages
Clear, actionable error messages help you identify and fix issues quickly:
Route "unknownRoute" not found in registry. Registered routes: [ 'home', 'about', 'user' ]Comprehensive Documentation
- Complete API reference with all functions documented
- Detailed feature guides with real-world examples
- Migration guide from v4 to v5
- Troubleshooting sections for common issues
Live Examples
Two full example applications demonstrate all features:
- Hash mode demo - Traditional #/path routing
- History mode demo - Clean URL routing
⚠️ Breaking Changes
While v5.0 includes breaking changes, the core routing API remains familiar. Most changes are straightforward find-and-replace operations:
$location→location()$params→routeParams()onrouteLoaded→onRouteLoadedsetDebugLoggingEnabled()→enableLogging()
See the Migration Guide for complete upgrade instructions.
🚀 Get Started
Ready to try v5.0? Install it now:
Then check out the Getting Started guide to build your first route!
💬 Feedback Welcome
Found a bug? Have a feature request? We'd love to hear from you: