-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Support React 19 #10942
Support React 19 #10942
Conversation
🦋 Changeset detectedLatest commit: 5770ff8 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
!preview react-19 |
Snapshots have been released for the following packages:
Publish Log
Build Log
|
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.
Note on React 19 types. From my testing, I also found that we use a server rendering API that is no longer available in the base React 19 package: renderToReadableStream()
. I needed to update this import from react-dom/server
to react-dom/server.browser
to access. Otherwise, React defaults to Node and only exposes rendertoPipeableStream()
from this package. Can you confirm you see the same issue in a test React 19 project?
@@ -62,8 +62,8 @@ | |||
"peerDependencies": { | |||
"@types/react": "^17.0.50 || ^18.0.21", |
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.
Should we add the @types/react
preview package as well? They are listed as npm:types-react@beta
and npm:types-react-dom@beta
. Not sure if the npm:
prefix works with peer deps though
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.
I don't know how to semver this, is it:
"@types/react": "^17.0.50 || ^18.0.21 || npm:types-react@beta"
I admit this is outside of my wheelhouse
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.
Yes, that looks correct. I tested locally to confirm whether npm will raise an exception resolving peer deps, and it unfortunately does. pnpm
works fine since it only warns for mismatched peer deps. I think we need to add this for everything to install correctly.
@bholmesdev The logic seems to fallback to astro/packages/integrations/react/server.js Lines 109 to 113 in befbda7
|
!preview react-19 |
Snapshots have been released for the following packages:
Publish Log
Build Log
|
@matthewp Ah okay, my guess is the react 17 conditional was triggering the wrong function. I see that was refactored here |
I added this to the 4.8 milestone @matthewp , I hope it's fine |
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.
Pushed a fix for the @types
peer dep. LGTM now
Thanks @bholmesdev ! |
- doesn't work yet because of withastro/astro#10942
Changes
Testing
Docs
N/A, bug fix