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

Should list react-dom under peerDependencies #26

Open
Eli-Black-Work opened this issue Apr 6, 2021 · 1 comment
Open

Should list react-dom under peerDependencies #26

Eli-Black-Work opened this issue Apr 6, 2021 · 1 comment

Comments

@Eli-Black-Work
Copy link

I believe react and react-dom should be listed as peer dependencies instead of dev dependencies in react-step-progress-bar's package.json file:

{
  "name": "react-step-progress-bar",
  ...
 "peerDependencies": {
    "react": ">=15.0.0",
    "react-dom": "^16.4.2",
  }
  ...
}

Without this, we have an issue:

Currently react-step-progress-bar depends on react-transition-group, which lists react-dom as a peer dependency. Since react-step-progress-bar lists react-dom as a dev dependency instead of a peer dependency, we get an error when using the library with Yarn Berry's PnP (Plug and Play) feature turned on:

ERROR in ../.yarn/$$virtual/react-transition-group-virtual-021191626d/0/cache/react-transition-group-npm-2.9.0-fe7767fa8d-eefed08c48.zip/node_modules/react-transition-group/Transition.js 10:39-59
Module not found: Error: react-transition-group tried to access react-dom (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: react-dom (via "react-dom")
Required by: react-transition-group@virtual:4e0481d59f5d66cf3116d074b13a99ce9c33abf71f662f1c9c14fc1fda7fcac2d6604772ecea3716dc354b1a167512f48a4447c115099e23390167c30f12c8f5#npm:2.9.0 (via C:\test\.yarn\$$virtual\react-transition-group-virtual-021191626d\0\cache\react-transition-group-npm-2.9.0-fe7767fa8d-eefed08c48.zip\node_modules\react-transition-group\)
Ancestor breaking the chain: react-step-progress-bar@virtual:d9fa77a61d1a58687e0657acb6213d1061af6346cca1d82a4cf23550ff092bba8562b73a2844cbe298af12f62f07538eee61c993cd754a68cdf0e444f69a337a#npm:1.0.3


 @ ../.yarn/$$virtual/react-transition-group-virtual-021191626d/0/cache/react-transition-group-npm-2.9.0-fe7767fa8d-eefed08c48.zip/node_modules/react-transition-group/index.js 9:41-64
 @ ../.yarn/$$virtual/react-step-progress-bar-virtual-4e0481d59f/0/cache/react-step-progress-bar-npm-1.0.3-4b70653a8b-795853650a.zip/node_modules/react-step-progress-bar/index.js 4:8-41
 @ ../.yarn/$$virtual/@my-package-virtual-d9fa77a61d/5/my-package/my-file.jsx 3:0-54 13:38-49
@Eli-Black-Work
Copy link
Author

As a workaround, users can add the following lines to their .yarmrc.yml file 🙂

# react-step-progress-bar depends on react-transition-group, which lists react-dom as a peerDependency. This means that react-step-progress-bar should also list react-dom as a peerDependency, but it doesn't yet.
# This gives us an error while compiling, so we patch react-step-progress-bar to add react-dom as a peerDependency
#
# Bug report: https://github.com/pierreericgarcia/react-step-progress-bar/issues/26
packageExtensions:
    react-step-progress-bar@*:
        peerDependencies:
            "react-dom": "*"

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

No branches or pull requests

1 participant