material-ui-popup-state icon indicating copy to clipboard operation
material-ui-popup-state copied to clipboard

Add react-dom to peerDependencies since requested by @mui/material, to resolve yarn warning

Open sjdemartini opened this issue 1 year ago • 0 comments

Right now, if you use yarn 2+ to install the latest version of material-ui-popup-state, you get this warning:

➤ YN0002: │ material-ui-popup-state@npm:5.0.8 [d9650] doesn't provide react-dom (p254f3), requested by @mui/material

for which the explanation is:

❯ yarn explain peer-requirements p254f3
➤ YN0000: material-ui-popup-state@npm:5.0.8 [d9650] doesn't provide react-dom, breaking the following requirements:

➤ YN0000: @mui/base@npm:5.0.0-alpha.128 [ce1f8]    → ^17.0.0 || ^18.0.0 ✘
➤ YN0000: @mui/material@npm:5.12.3 [5acc5]         → ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-transition-group@npm:4.4.5 [ce1f8] → >=16.6.0           ✘

➤ YN0000: Note: these requirements start with @mui/material@npm:5.12.3

In other words, since @mui/material requests react-dom as a peer dependency, material-ui-popup-state needs to either list it as a dependency or a peer dependency. Since react-dom is not being used directly within the source for this project, it's added as a peer dependency here to resolve the issue. (Note that the above warning shows up even though the project where material-ui-popup-state is being installed lists react-dom itself. See below for more info.)

Additional context

See https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency and the linked blog post, and note the peerDependencies definition used for @mui/material here.

sjdemartini avatar May 02 '23 19:05 sjdemartini