Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Inaccurate Peer Dependency Declaration in react-router-config #12173

Closed
Deol opened this issue Oct 22, 2024 · 1 comment
Closed

[Bug]: Inaccurate Peer Dependency Declaration in react-router-config #12173

Deol opened this issue Oct 22, 2024 · 1 comment
Labels

Comments

@Deol
Copy link

Deol commented Oct 22, 2024

What version of React Router are you using?

6.27.0

Steps to Reproduce

react-router-config version: 5.1.1
react-router version: 6.x

import { matchRoutes } from 'react-router-config';

const routes = [
  {
    component: Root,
    routes: [
      {
        path: "/",
        exact: true,
        component: Home
      },
      {
        path: "/child/:id",
        component: Child,
        routes: [
          {
            path: "/child/:id/grand-child",
            component: GrandChild
          }
        ]
      }
    ]
  }
];

matchRoutes(routes, "/child/23");
pathname.match is not a function
TypeError: pathname.match is not a function
    at matchPath (webpack-internal:///./node_modules/@remix-run/router/dist/router.js:834:24)
    at eval (webpack-internal:///./node_modules/react-router-config/esm/react-router-config.js:23:85)
    at Array.some (<anonymous>)
    at matchRoutes (webpack-internal:///./node_modules/react-router-config/esm/react-router-config.js:22:10)

Expected Behavior

The react-router-config@5 package should list react-router@5 as a peer dependency to ensure compatibility. This prevents runtime issues with the matchPath function, which changed in react-router@6. Users need to use react-router-config safely without errors related to matchPath.

Actual Behavior

The peerDependencies for [email protected] state that react-router must be version >=5. However, with the release of react-router@6, the matchPath function changed in a way that breaks compatibility with react-router-config@5. As a result, using react-router-config@5 with react-router@6 can lead to issues.

@Deol Deol added the bug label Oct 22, 2024
@timdorr
Copy link
Member

timdorr commented Oct 22, 2024

While the peerDep is wider than it should be (we built that package well before v6 was even conceived), it's still on the user to install the correct version. This is an older and deprecated package (it's code is not even easily visible in this repo), so we won't be updating it.

@timdorr timdorr closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants