-
Notifications
You must be signed in to change notification settings - Fork 325
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
Add React / DOM 17 to peer deps #432
Conversation
Getting peer dependency warnings without this. |
@blainekasten can you please review? |
"react": "16.12.0", | ||
"react-dom": "16.12.0", | ||
"react": "16.12.0 || ^17.0.1", | ||
"react-dom": "16.12.0 || ^17.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since they don't include 15 or 16 for devdependencies, is there any reason to match against 16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who are "they" and where don't they include 15 or 16 to devdeps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"They" are the people who own this package.json
and I mispoke, they didn't do 15 || 16
, so why now do 16 || 17
for devDependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a fail safe. It doesn't hurt to leave it there since 16 and 17 are compatible (which is not the case for 15 and 16)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compatible in what way? They're breaking versions, so at least some incompatibility must exist.
Either way I guess it's not a blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCROLL DOWN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, there's no point in having 16 || 17
in devDependencies since yarn will always install v17, see yarn.lock change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can see that Rollup is set up to removed react and react-dom from the bundle, thus the devDependancy really does not need to change.
"react-dom": "16.12.0 || ^17.0.1", | |
"react-dom": "16.12.0 || ^17.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hole point of React 17
@alexandernst I think you mean, "The whole point...". 😉
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.12.0.tgz#0da4b714b8d13c2038c9396b54a92baea633fe11" | ||
integrity sha512-LMxFfAGrcS3kETtQaCkTKjMiifahaMySFDn71fZUNpPHZQEzmk/GiAeIT8JSOrHB23fnuCOMruL2a8NYlw+8Gw== | ||
"[email protected] || ^17.0.1": | ||
version "17.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this
"react": "15.x || 16.x || 16.4.0-alpha.0911da3", | ||
"react-dom": "15.x || 16.x || 16.4.0-alpha.0911da3" | ||
"react": "15.x || 16.x || 16.4.0-alpha.0911da3 || ^17.0.1", | ||
"react-dom": "15.x || 16.x || 16.4.0-alpha.0911da3 || ^17.0.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexandernst. Yuck... unfortunately, I think you are just adding to this mess. A Git blame for this line shows that the previous author wrote a commit message: "Yeah I dunno". My 2 cents is that the peer dependencies should be cleaned up, using just one wild-card format. ^x.x.x
is more commonly used and also explicit. This would be far cleaner:
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0 || ^17.0.0",
"react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0"
},
For reference, here are some similar repo's addressing this issue: material-ui.
Alternatively, react-router doesn't even need to change any code to support React 17; however, I agree with Martin Fowler and others that "To Be Explicit" is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another way to do it is "15 - 17"
For some extra context, people who are having issues are likely using NPM v7 where their project will completely fail to install due to peerDependency conflicts. I think in v6 or Yarn they basically ignore peerDepencencies (giving a warning at best), so anyone using those won't have failed installations (even though technically the dependency tree is invalid). Most JS projects are facing teething pains adapting to NPM v7 now that it finally does the right thing so no blame there's just some tweaks and getting used to it. Good luck to all! 🚀 Personally I wonder if simply I think there's another blocker though because Reach Router strictly depends on create-react-context which has it's own strict dependency on React 16 and under. AKA I don't think this PR will actually fix Reach Router's React 17 support until create-react-context is similarly updated to support React 17, and then Reach Router needs to have a looser / updated dependency on create-react-context. Finally for anyone Googling, Storybook v6.1 supposedly supports React 17 but actually doesn't due to Reach Router / create-react-context's peer dependencies. |
@sfcgeorge I just wanted to clarify that I was referring to |
Not interested in following this anymore. Please feel free to copy this MR and submit it on your behalf. |
@alexandernst Why bother opening a PR for an Open Source project if you are not willing to take the feedback of the community? |
I just lost interest in using this particular library (dropped the dependency from my project). As I said, feel free to take my MR, make any changes that you're willing to apply and submit it. |
@sfcgeorge Storybook 6.1 supports React 17, just not with NPM 7's stricter enforcement of peer dependencies. If you install with yarn or npm7 using |
No description provided.