[QUESTION] Eliminate unnecessary dependencies
See original GitHub issueI use the package @chakra-ui/react and it contains all the packages that I get the warning message
warning " > chakra-react-select@3.1.2" has unmet peer dependency "@chakra-ui/form-control@^1.0.0".
warning " > chakra-react-select@3.1.2" has unmet peer dependency "@chakra-ui/icon@^2.0.0".
warning " > chakra-react-select@3.1.2" has unmet peer dependency "@chakra-ui/layout@^1.0.0".
warning " > chakra-react-select@3.1.2" has unmet peer dependency "@chakra-ui/menu@^1.0.0".
warning " > chakra-react-select@3.1.2" has unmet peer dependency "@chakra-ui/spinner@^1.0.0".
warning " > chakra-react-select@3.1.2" has unmet peer dependency "@chakra-ui/system@^1.2.0".
can you remove them in upcoming updates
Issue Analytics
- State:
- Created a year ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Is there a simple way to remove unused dependencies from a ...
DepClean is a tool to automatically remove dependencies that are included in your Java dependency tree but are not actually used in the...
Read more >Problems caused by unused dependencies - Help
By removing any unused references in your application, you are preventing the CLR from loading the unused referenced modules at runtime.
Read more >how do I eliminate unused packages in version 15.04
So running sudo apt-get autoremove will uninstall the unused packages which were used as dependencies for other packages.
Read more >How do I remove unused dependencies from the project?
The questions is: how can I removed the unused now libraries from my project? By project I mean the Idea project and specially...
Read more >linux - Does dnf autoremove remove only unused packages ...
Please be sure to answer the question. Provide details and share your research! ... Asking for help, clarification, or responding to other answers ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah so maybe it’s an issue with the way yarn does peer dependency installations vs the npm cli.
I switched from having
@chakra-ui/react
as a peer dependency to the specific sub-dependencies that@chakra-ui/react
uses in a recent version based on this discussion, in order to allow for its use in cases where someone doesn’t have the whole package installed. I had worried about users needing to install the individual peer dependencies in addition to@chakra-ui/react
, but in my testing I realized that from npm version7.0.0
and above (released on October 13th, 2020), NPM will automatically install peer dependencies. This would also allow the peer dependencies to be de-duped between@chakra-ui/react
and this package so if you already had it installed, this package’s peer deps would not be installed again.I can look into how yarn is affected by this change as well, as I’d prefer to keep the installation as simple as possible for the majority of users.
For the next question, I assume you’re talking about a Next.js application, where the automatically generated IDs from
react-select
are being generated on the server and the client. The solution is to add theinstanceId
prop to your select component:Here’s the relevant section from the react-select docs:
It’s good to note that this warning isn’t a breaking bug, and your app will run fine, but it can have performance implications.
In some cases you can also get this error from Chakra elements which have automatic ID generation such as the form control, as seen in these issues:
If you are still having the issue and you are wrapping your select in a
FormControl
, add anid
to yourFormControl
component and that should fix your issue:And lastly, when you say “background property is not available” I’m not sure where you mean. You can use the
chakraStyles
prop to style any of the sub components in this package. If you’re talking about the entire select component, then you probably want to add the background color to thecontrol
key of thechakraStyles
object:The
@chakra-ui/icon
package does also comes with@chakra-ui/react
(not@chakra-ui/icons
).What version of the npm cli are you using?
npm --version
Because from version 7 onward, peer dependencies should be installed automatically. In addition, if you have @chakra-ui/react installed, the common dependencies between that and this package will be de-duped.