The issue can be demonstrated by this test:
it('should prefer explicit path', ( ) => {
const node = new RouteNode('', '', [
new RouteNode('a', '/a', [
new RouteNode('b', 'b'),
]),
new RouteNode('c', '/:a/:b'),
]);
withoutMeta(node.matchPath('/a/b')).should.eql({ name: 'b', params: { } });
});
For example, this use case will be failing
github.com/:username/:repo is matched by a node directly from root as it has no dependency on github.com/:username
github.com/settings/profile is matched by a node under /settings as /settings will handle the sidebar rendering.
If this routing is done by router5, /settings/profile will be matched to the /:username/:repo route.