Closed honungsburk closed 1 year ago
I am encountering this issue today as well, trying to use use-query-params in a project bundled with Yarn.
I'd suggest the issue is that nested package.json files are not valid outside of a workspace scenario. I think Yarn is treating use-query-params/adapters/react-router-6
as a package unto itself which does not declare any dependencies so it must externalize the dependency.
To me, it would make the most sense if each adapter were its own package. I was surprised by that not being the case.
You need to upgrade react router. It is working as of latest version 6.8.1
For anyone encountering this error, if you are using pnpm
, you can fix this issue by adding following to your package.json
:
"pnpm": {
"packageExtensions": {
"use-query-params@2.2.0": {
"peerDependencies": {
"react-router-dom": ">= 5"
},
"peerDependenciesMeta": {
"react-router-dom": {
"optional": true
}
}
}
}
}
I will try to prepare PR fixing this for everyone.
What I am trying to do
I want to load the library and use it with
react-router-dom
What I expect to happen
That I can load the library.
What actually happens
vite throws an error because "react-router-dom" is missing
main.tsx:
Additional information