Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sjdemartini
Copy link

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.

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.

(For additional context, see
https://yarnpkg.com/advanced/error-codes#yn0002---missing_peer_dependency
and the linked blog post
https://dev.to/arcanis/implicit-transitive-peer-dependencies-ed0, and
note the `peerDependencies` definition used for `@mui/material`:
https://github.com/mui/material-ui/blob/9710ff34b16a0f271107a8619a28546ae3ca7c18/packages/mui-material/package.json#L48-L49).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant