-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
feat(v2): support/use React v17 by default #4218
Conversation
[V1] Deploy preview success Built with commit 099bbae |
Deploy preview for docusaurus-2 ready! Built with commit 099bbae |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4218--docusaurus-2.netlify.app/classic/ |
Size Change: -1 B (0%) Total Size: 156 kB ℹ️ View Unchanged
|
examples/classic/package.json
Outdated
"react": "^16.8.4", | ||
"react-dom": "^16.8.4" | ||
"react": "^16.8.4 || ^17.0.0", | ||
"react-dom": "^16.8.4 || ^17.0.0" |
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.
FYI @lex111 , examples should only be updated with yarn examples:generate after a release, and generated from the officially published init cli.
This is because these examples are actually used by CodeSandbox so if you use new Docusaurus features/versions that are not yet released, all the CodeSandboxes may fail until you publish those new features to npm.
So, the idea is that the examples somehow lag behind, and we only update them just after releasing.
They'll update to React 17 once we release the new versions with the new init templates.
In this case it should not cause any trouble so I'll let these versions
FYI I added a "@docusaurus/react-loadable" fork as the warning is annoying in dev and we are safe until React 18 gets released. More infos: jamiebuilds/react-loadable#213 (comment) BTW, the "module-alias" thing I added will also be useful to support a Preact mode during SSR. At least it's the solution used by NextJS: |
It looks like we can't use React 17 on our site for v2. |
Looked at that error, I think it will work now |
😅 now v1 fails |
🥳 thanks, seems to work fine finally! |
* chore(v2): allow React v17 as peer dependency * minor React 17 changes * Revert examples * Possible fix * Use @docusaurus/react-loadable fork * add back react-loadable to please eslint/ts/linters, even if it's unused in practice * missing dependency bump * move enzyme dependencies to docusaurus v1 Co-authored-by: slorber <lorber.sebastien@gmail.com>
Motivation
This should allow React v17 to be used on Docusaurus websites.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
E2E test, I suppose.
Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)