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

Use React as a peer dependency #149

Merged
merged 1 commit into from
Jun 4, 2023
Merged

Use React as a peer dependency #149

merged 1 commit into from
Jun 4, 2023

Conversation

woofers
Copy link

@woofers woofers commented May 27, 2023

This PR sets up the package to use React as a peer dependency.

This is the recommended way to add React to an external library and how many members of the React core team have it setup in their packages.

This means that html-to-react will now leverage the version of React that the user has installed, instead of potentially using a different version within the module if the user is not on React v18. This was causing an increased bundle size when installing v1.5.1 when compared to v1.5.0 which this should resolve.


@aknuds1 Thanks again for maintaining this module as it has been extremely useful for handling HTML passed from a sever in a safe and customizable way.

@coveralls
Copy link

coveralls commented Jun 3, 2023

Coverage Status

coverage: 100.0%. remained the same when pulling 5a4c306 on woofers:fix/react-peer-dep into a968c43 on aknuds1:master.

Copy link
Owner

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally LGTM, just wondering why you decided on that React version range to depend on instead of 18.x (or greater or equal than 18.x)?

package.json Show resolved Hide resolved
@aknuds1
Copy link
Owner

aknuds1 commented Jun 3, 2023

I introduced some conflicts in your PR with my latest changes on master, please resolve them :)

This commit sets up the package to use React as a peer dependency.

This is the [recommended way](https://stackoverflow.com/a/30454133) to add React to an external library and how many members of the React core team have it setup in [their packages](https://github.com/gaearon/react-side-effect/blob/master/package.json#L33).

This means that html-to-react will now leverage the version of React that the user has installed, instead of potentially using a different version within the module if the user is not on React v18.  This was causing an increased bundle size when installing `v1.5.1` when compared to `v1.5.0` which this should resolve.
@woofers
Copy link
Author

woofers commented Jun 3, 2023

I introduced some conflicts in your PR with my latest changes on master, please resolve them :)

@aknuds1 Thanks for the review, updated

@woofers woofers requested a review from aknuds1 June 3, 2023 18:05
Copy link
Owner

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aknuds1 aknuds1 merged commit 2191475 into aknuds1:master Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants