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

List prop-types under optionalDependencies #322

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

List prop-types under optionalDependencies #322

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

Comments

@Eli-Black-Work
Copy link

Eli-Black-Work commented Apr 6, 2021

react-async uses prop-types if it's available, but it doesn't list it as an optional dependency in its package.json

This means that users see a warning when using Yarn's PnP (Plug and Play) feature:

WARNING in ../.yarn/$$virtual/react-async-virtual-3d2eb0f2b6/0/cache/react-async-npm-10.0.1-4e014b49b8-dd7e80d975.zip/node_modules/react-async/dist-web/index.js 35:14-35
Module not found: Error: Can't resolve 'prop-types' in 'C:\my-project\.yarn\$$virtual\react-async-virtual-3d2eb0f2b6\0\cache\react-async-npm-10.0.1-4e014b49b8-dd7e80d975.zip\node_modules\react-async\dist-web'
 @ ../.yarn/$$virtual/@my-project-virtual-d9fa77a61d/5/my-project/my-file.js 2:0-39 32:20-28

I think that the fix should be for react-async to add prop-types as an optional dependency in its package.json file, like so:

"optionalDependencies": {
   "prop-types": "*"
}

This was previously reported at #115, but that issue is closed, so I'm opening a new one 🙂

@Eli-Black-Work
Copy link
Author

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

# react-async depends on prop-types but doesn't yet list it as an optional dependency, so we see a warning when we compile.
# This fixes that warnings.
#
# Bug report: https://github.com/async-library/react-async/issues/322
packageExtensions:
    react-async@*:
        peerDependencies:
            "prop-types": "*"

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