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

Evaluate specifying React in package.json's peerDependencies instead of failing at runtime #1

Open
roberto-red opened this issue Mar 24, 2023 · 1 comment

Comments

@roberto-red
Copy link
Member

roberto-red commented Mar 24, 2023

This package is dependent of React, but its package.json does not mention React anywhere. Instead, the code uses a dynamic CommonJS require() in order to be able to show an error when React is not installed.

This may be solved with package.json's peerDependencies, which also allows us to specify which React version the code is compatible with. Here is an in-depth explanation from the node.js blog:

https://nodejs.org/en/blog/npm/peer-dependencies

I've personally never used it before and there might be some pitfalls, so this change will need to be thoroughtly evaluated first.

@roberto-red roberto-red changed the title Evaluate specifying React as a peerDependencies in package.json instead of failing at runtime Evaluate specifying React in package.json's peerDependencies instead of failing at runtime Mar 24, 2023
@acontreras89
Copy link
Member

acontreras89 commented Jun 15, 2023

+1

This is what I had in mind when thinking about publishing these utilities as a standalone package.

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

2 participants