From ae62e39001ddfd4282abcfdda988b624006aa96f Mon Sep 17 00:00:00 2001 From: Steven DeMartini Date: Tue, 2 May 2023 12:09:00 -0700 Subject: [PATCH] Add react-dom to peerDependencies since requested by @mui/material MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6ab544c..8a0476f 100644 --- a/package.json +++ b/package.json @@ -194,7 +194,8 @@ "prop-types": "^15.7.2" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" }, "release": { "branches": [