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

Support for peer dependencies in v2 #3753

Closed
wants to merge 3 commits into from
Closed

Support for peer dependencies in v2 #3753

wants to merge 3 commits into from

Conversation

subhero24
Copy link
Contributor

@subhero24 subhero24 commented Nov 7, 2019

As requested in #3674 I implemented support for peer dependencies in v2 with integration tests.
This changes the module resolution to discard packages that where specified as peer dependencies. It also excludes files from the bundle if all references to a package where specified as a peer dependency.

This solves issues:
#144
#3305

@mischnic
Copy link
Member

So if I have react-dom as a dependency and have not installed react, this would throw something like Cannot resolve 'react' from .../my-project. And I wouldn't know that react-dom caused this.

We should print a more helpful error (and maybe hint at how to solve this: adding as a peerDependency or a dependency)

@FreeFrags
Copy link

Whats the status of this issue? Seems like there are many issues which are all on the same subject. This looks like the latest conversation about it. it would be amazing if this gets supported.

@lots0logs

This comment has been minimized.

@mischnic
Copy link
Member

@subhero24 Can you/do you want to update this?

@subhero24
Copy link
Contributor Author

So if I have react-dom as a dependency and have not installed react, this would throw something like Cannot resolve 'react' from .../my-project. And I wouldn't know that react-dom caused this.

Currently the error for the unfound peer dependency is Cannot find module 'react' from '../my-project/node_modules/react-dom' so the user knows it was caused by react-dom. Is that enough? or would you still want the more helpful hint about adding it as a (peer)dependency? (isn't this hint about adding it as a (peer)dependency applicable to all Cannot find module ... errors though?)

@DeMoorJasper
Copy link
Member

#4072 implemented another way of doing this.

Gonna close this for now as it's probably no longer needed, feel free to re-open discussion on more excluding of modules improvements

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.

None yet

5 participants