Skip to content

getRoutes() in Vue3 Bridge flattens nested routes and breaks hierarchy #3897

@wvillaizan

Description

@wvillaizan

Describe the bug

The Vue3 Bridge uses router.getRoutes() internally, which flattens the route hierarchy. This breaks nested routes that rely on parent-child relationships.

// In bridge-vue3/src/provider.ts line 62:
let routes = bridgeOptions.router.getRoutes();

Workaround

Add a name to each nested route to ensure correct behavior.

Proposed Fix

Replace router.getRoutes() with router.options.routes to preserve the nested structure.

Environment

  • @module-federation/bridge-vue3: ^0.16.0
  • Vue: ^3.5.17
  • vue-router: ^4.5.1

Reproduction

N/A

Used Package Manager

npm

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 6.06 GB / 31.71 GB
  Binaries:
    Node: 22.16.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (138.0.3351.65)
    Internet Explorer: 11.0.22621.3527

Validations

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions