pbeshai / use-query-params

React Hook for managing state in URL query parameters with easy serialization.
https://pbeshai.github.io/use-query-params
ISC License
2.13k stars 95 forks source link

fix: specify peerDependencies for adapters compatibility #261

Closed DamianOsipiuk closed 1 year ago

DamianOsipiuk commented 1 year ago

This PR should fix https://github.com/pbeshai/use-query-params/issues/256

Despite this repo setup, all packages are published as a single npm package. Sub-packages have their package.json stripped to the simplest form.

This setup is causing some bundlers to not be able to pick up peerDependencies for adapters and in turn failing the build.
It might also be caused by pnpm node_modules linking strategy.

Personally i have encountered the error by using pnpm and vite together.

By adding peerDependencies to the main package.json we are ensuring that those dependencies would be properly linked when installing packages.

pbeshai commented 1 year ago

Does this cause warnings for every person installing the library since nobody will have all these peer dependencies? Or does peerDependenciesMeta fix that?

DamianOsipiuk commented 1 year ago

They are marked as optional, so users will not get any warnings, unless they will use some super old or non-standard package manager. For npm it supported from v7, yarn and pnpm support this from the start i believe.

https://docs.npmjs.com/cli/v9/configuring-npm/package-json#peerdependenciesmeta

pbeshai commented 1 year ago

Cool, thanks for this

pbeshai commented 1 year ago

In v2.2.1