I am dealing with a situation where I have a package called react-router
, which relies on another package called path-to-regexp
. The challenge is that react-router
does not provide its own import of path-to-regexp
. So, I am wondering how I can import the exact same version of path-to-regexp
that react-router
uses in my top-level module. Is this even possible?
Currently, I am using Yarn as my dependency manager, and I am contemplating utilizing its resolution
configuration to address this issue. However, I am concerned that potential version discrepancies may arise in the future.
If only I could do something like
import path from 'react-router/node_modules/path-to-regexp'
, but unfortunately, that method does not seem to work. Alternatively, if I list path-to-regexp
as a dependency in my top-level module, there is still a risk of encountering version mismatches in the long run. Perhaps there is a way to use node-semver
globs to specify the same version as react-router
in my package.json
file?