react-tippy
react-tippy copied to clipboard
List React and React DOM as peer dependencies
Currently they are listed as dev dependencies, but this is incorrect - both are needed by the package during production. devDependencies
should only be used for dependencies that are not required at all for production. The recommended method for React 'plugins' like this is to list React as a peer dependency. I would create a PR (it's only four lines of change in package.json
), but I'm not sure which versions of React this package is compatible with.
How can you use React without these 2 libraries? @ZhangYiJiang
Peer dependency means that the library can be installed with future versions of React, and npm or yarn will only emit a warning if the peer dependency is not met. If "react": "^16"
is specified, then when React 17 is released this package's package.json
will also needs to be updated, otherwise an extra copy of React 16 will be installed for anyone who asks for React 17 but is also using this package.
An alternative approach is to specify "react": ">15"
, but that's also dangerous because React 17 might contain breaking changes that break this package. Peer dependency strikes a good middle ground because the package manager emits a warning but still allows you to use the package at your own risk.