HarmonyOS Router 1.1.0 Automates Route Setup: One Plugin, No More Manual Annotations
Teams on modular HarmonyOS projects can now centralize all route definitions in one package and let the IDE generate registration code, which removes a recurring source of boilerplate and prefix mismatches. The payoff depends on enforcing the single-module rule, since the plugin only works if every page route goes through it.
Router 1.1.0 for HarmonyOS replaces the old string-based route registration with a dedicated route management module and a plugin that auto-generates both the page and its route entry. Pages created via the IDE's 'Router Module Page' option automatically register in a shared router package, so developers no longer hand-write @RouterPath annotations or import statements.
The update also solves the module-prefix problem. Routes in the management module are defined without prefixes, and the RouterManager class calls getRouterModuleName to map module constants to their actual route names. Cross-module navigation now goes through a single, centralized RouterManager, which keeps the full route map searchable in one place.
The catch is discipline. The author stresses that every route must live in the router module, or the auto-generation and central lookup break down. Teams that adopt this need to enforce the convention across all modules.
Centralizing routes in a single module turns route management into a team convention; the author explicitly warns against some developers going rogue, so the real adoption barrier is process, not code.
Keeping route strings free of module prefixes while injecting prefixes internally via getRouterModuleName preserves cross-platform identifier reuse, which was a stated pain point.
Removing manual annotation and import steps shifts work to the IDE plugin, so route consistency depends on everyone using the same generation path.