React 19
Fixes #2756
🦋 Changeset detected
Latest commit: b190eb3ab86d4f2da5816e4e6b394c7acb5f191d
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 4 packages
| Name | Type |
|---|---|
| @react-pdf/renderer | Major |
| @react-pdf/examples | Patch |
| @react-pdf/e2e-node-cjs | Patch |
| @react-pdf/e2e-node-esm | Patch |
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
Currently both react-reconciler.development.js and react-reconciler.production.js are included in the bundle, which isn't optimal. I don't see any good alternative though, since jsx-runtime in dev requires dev specific APIs of the reconciler
We could move react-reconciler to a dependency and stop inlining it, but that could cause other issues (duplicate deps etc). Another option is to create separate prod and dev bundles, just like React does. Would be annoying to manage with both esm and cjs tho
no solutions ?
This is a solution for react19 at the expense of dropping support for all other versions for what I understand. Is that correct?
Yes, that is my understanding. That said, I've not tested this branch with React 18
Hi, is there an estimate of when this PR will be merged into the main branch? Our project kind of depends on this. Thanks in advance.
@alexandernanberg is this updated to what's published in npm? I validated this code works for React 19 when installing from npm, but I'm working on a solution to support both the previous versions and 19 at the same time. I tried this code in my solution and there it fails and I'm not seeing the difference
@alexandernanberg here's the branch where I'm pushing that. My idea is to ship both reconcilers, and dynamically use one or the other based on React version. Code there is the one included in this PR, but different structured because of that reason. However, when trying it out I get the following errors.
Did you get those on your testing by any chance? Would you have the time to take a look at my branch? I'm planning to add you as co-author of it anyways :) Thanks in advance
is this updated to what's published in npm?
Yes, but cut a new 4.0.0-canary-5 just to be sure. Still works as expected in my app.
Did you get those on your testing by any chance?
I don't remember exactly, but I did have some issues when trying to use the prod reconciler with dev react or vice versa, the prod bundles are slimmed down and don't include everything. The React packages use dynamic import/requires https://github.com/facebook/react/blob/main/packages/react-reconciler/npm/index.js
I'll take a look at your branch when I have some time to spare!
Will close this in favor of https://github.com/diegomura/react-pdf/pull/2941 where I kept support for all the previous React versions too. @alexandernanberg thanks so much for posting this. It was very helpful. Added you as a co-author of the PR although I don't know your email to correctly add the commit message
Cool, look forward to trying it out! Added my email to my GitHub profile but probably annoying to change it afterwards
Not at all! Just did
Thanks for the help man!