Skip to content

Commit

Permalink
BREAKING CHANGE: Make react-is a peer dependency (#4541)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description

Make `react-is` a peer dependency instead of a direct dependency

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Motivation and Context

`react-is` needs to be the same version as the used version of React. So
far these dependencies could be out of sync since the related internals
didn't changed. However, in React 19 related internals did change. Using
`react-is<19` would not recognize elements from `react>=19` and vice
versa. So generally, `react-is` should be installed by library users
just like React. That way, users can make sure the versions match
without having to resort to `resolutions` or `overrides` which wouldn't
even work for libraries.

## How Has This Been Tested?



## Screenshots (if appropriate):

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I have added tests to cover my changes.
- [x] I have added a storybook story or extended an existing story to
show my changes
  • Loading branch information
eps1lon committed May 17, 2024
1 parent 0564536 commit 2f8c8a0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 104 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,19 @@ NPM is the easiest and fastest way to get started using Recharts. It is also the

```sh
# latest stable
$ npm install recharts
$ npm install recharts react-is
```

`react-is` needs to match the version of your installed `react` package.

### umd

The UMD build is also available on unpkg.com:

```html
<script src="https://unpkg.com/react/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/react-is/umd/react-is.production.min.js"></script>
<script src="https://unpkg.com/recharts/umd/Recharts.min.js"></script>
```

Expand Down
123 changes: 22 additions & 101 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"homepage": "https://github.com/recharts/recharts",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-is": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"dependencies": {
"@reduxjs/toolkit": "^2.2.3",
Expand All @@ -78,7 +79,6 @@
"eventemitter3": "^4.0.1",
"immer": "^10.1.1",
"lodash": "^4.17.21",
"react-is": "^16.10.2",
"react-redux": "^8.1.3",
"react-smooth": "^4.0.0",
"tiny-invariant": "^1.3.1",
Expand Down Expand Up @@ -150,6 +150,7 @@
"prettier": "^2.2.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-is": "^18.3.1",
"react-router-dom": "^5.1.2",
"rimraf": "^3.0.2",
"storybook": "^8.0.4",
Expand Down
6 changes: 6 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ const config = {
commonjs: 'react-dom',
amd: 'react-dom',
},
'react-is': {
root: 'ReactIs',
commonjs2: 'react-is',
commonjs: 'react-is',
amd: 'react-is',
},
'prop-types': {
root: 'PropTypes',
commonjs2: 'prop-types',
Expand Down

0 comments on commit 2f8c8a0

Please sign in to comment.