Skip to content
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

Enforce that the "react-server" build of "react" is used #27436

Merged
merged 6 commits into from
Sep 29, 2023

Conversation

sebmarkbage
Copy link
Collaborator

@sebmarkbage sebmarkbage commented Sep 29, 2023

I do this by simply renaming the secret export name in the "subset" bundle and this renamed version is what the FlightServer uses.

This requires us to be more diligent about always using the correct instance of "react" in our tests so there's a bunch of clean up for that.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Sep 29, 2023
@react-sizebot
Copy link

react-sizebot commented Sep 29, 2023

Comparing: 62512ba...63064a6

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 167.55 kB 167.55 kB = 52.15 kB 52.15 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 176.22 kB 176.22 kB = 54.84 kB 54.84 kB
facebook-www/ReactDOM-prod.classic.js = 563.60 kB 563.60 kB = 99.30 kB 99.30 kB
facebook-www/ReactDOM-prod.modern.js = 547.32 kB 547.32 kB = 96.39 kB 96.39 kB
oss-experimental/react-dom/react-dom.shared-subset.js +∞% 0.00 kB 0.23 kB +∞% 0.00 kB 0.16 kB
oss-stable-semver/react-dom/react-dom.shared-subset.js +∞% 0.00 kB 0.23 kB +∞% 0.00 kB 0.16 kB
oss-stable/react-dom/react-dom.shared-subset.js +∞% 0.00 kB 0.23 kB +∞% 0.00 kB 0.16 kB
oss-experimental/react/umd/react.development.js = 125.73 kB 107.24 kB = 32.51 kB 27.83 kB
oss-stable/react/umd/react.development.js = 123.16 kB 104.66 kB = 31.89 kB 27.20 kB
oss-stable-semver/react/umd/react.development.js = 123.13 kB 104.64 kB = 31.86 kB 27.17 kB
oss-experimental/react/umd/react.production.min.js = 13.02 kB 9.21 kB = 4.99 kB 3.52 kB
oss-experimental/react/umd/react.profiling.min.js = 13.01 kB 9.21 kB = 4.99 kB 3.52 kB
oss-stable/react/umd/react.production.min.js = 12.13 kB 8.32 kB = 4.72 kB 3.24 kB
oss-stable/react/umd/react.profiling.min.js = 12.13 kB 8.32 kB = 4.72 kB 3.24 kB
oss-stable-semver/react/umd/react.production.min.js = 12.10 kB 8.30 kB = 4.69 kB 3.21 kB
oss-stable-semver/react/umd/react.profiling.min.js = 12.10 kB 8.30 kB = 4.69 kB 3.21 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react-dom/react-dom.shared-subset.js +∞% 0.00 kB 0.23 kB +∞% 0.00 kB 0.16 kB
oss-stable-semver/react-dom/react-dom.shared-subset.js +∞% 0.00 kB 0.23 kB +∞% 0.00 kB 0.16 kB
oss-stable/react-dom/react-dom.shared-subset.js +∞% 0.00 kB 0.23 kB +∞% 0.00 kB 0.16 kB
oss-stable-semver/react-server/cjs/react-server-flight.production.min.js +1.52% 16.64 kB 16.90 kB +1.67% 5.97 kB 6.07 kB
oss-stable/react-server/cjs/react-server-flight.production.min.js +1.52% 16.64 kB 16.90 kB +1.67% 5.97 kB 6.07 kB
oss-experimental/react-server/cjs/react-server-flight.production.min.js +1.42% 17.77 kB 18.03 kB +1.58% 6.25 kB 6.35 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.min.js +1.00% 25.29 kB 25.55 kB +1.10% 8.74 kB 8.84 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.min.js +1.00% 25.29 kB 25.55 kB +1.10% 8.74 kB 8.84 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.min.js +0.97% 26.01 kB 26.27 kB +1.13% 8.87 kB 8.97 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.min.js +0.97% 26.01 kB 26.27 kB +1.13% 8.87 kB 8.97 kB
oss-stable-semver/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.production.min.js +0.97% 26.19 kB 26.44 kB +1.07% 8.99 kB 9.09 kB
oss-stable/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.production.min.js +0.97% 26.19 kB 26.44 kB +1.07% 8.99 kB 9.09 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.min.js +0.96% 26.33 kB 26.59 kB +1.08% 8.98 kB 9.08 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.min.js +0.96% 26.33 kB 26.59 kB +1.08% 8.98 kB 9.08 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.production.min.js +0.96% 26.45 kB 26.70 kB +1.11% 9.03 kB 9.13 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +0.95% 26.76 kB 27.02 kB +1.01% 9.08 kB 9.17 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +0.95% 26.76 kB 27.02 kB +1.01% 9.08 kB 9.17 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +0.94% 26.92 kB 27.18 kB +0.97% 9.20 kB 9.29 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +0.94% 26.92 kB 27.18 kB +0.97% 9.20 kB 9.29 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.94% 26.97 kB 27.22 kB +1.02% 9.14 kB 9.24 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.94% 26.97 kB 27.22 kB +1.02% 9.14 kB 9.24 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.production.min.js +0.93% 27.23 kB 27.48 kB +1.05% 9.18 kB 9.27 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.min.js +0.93% 27.32 kB 27.57 kB +1.04% 9.33 kB 9.43 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.min.js +0.93% 27.32 kB 27.57 kB +1.04% 9.33 kB 9.43 kB
oss-experimental/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.production.min.js +0.92% 27.41 kB 27.66 kB +1.06% 9.28 kB 9.38 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.production.min.js +0.92% 27.55 kB 27.80 kB +1.07% 9.28 kB 9.38 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.min.js +0.91% 27.82 kB 28.08 kB +1.01% 9.49 kB 9.58 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.min.js +0.91% 27.82 kB 28.08 kB +1.01% 9.49 kB 9.58 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.production.min.js +0.90% 27.98 kB 28.23 kB +1.00% 9.37 kB 9.47 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0.90% 28.12 kB 28.37 kB +0.96% 9.54 kB 9.63 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0.90% 28.12 kB 28.37 kB +0.96% 9.54 kB 9.63 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.production.min.js +0.90% 28.14 kB 28.39 kB +1.01% 9.51 kB 9.60 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js +0.90% 28.18 kB 28.43 kB +1.01% 9.45 kB 9.55 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.production.min.js +0.89% 28.48 kB 28.73 kB +1.00% 9.62 kB 9.72 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +0.88% 28.63 kB 28.88 kB +0.94% 9.70 kB 9.80 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +0.88% 28.63 kB 28.88 kB +0.94% 9.70 kB 9.80 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.production.min.js +0.87% 28.98 kB 29.23 kB +1.00% 9.78 kB 9.87 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.production.min.js +0.86% 29.27 kB 29.53 kB +0.95% 9.82 kB 9.92 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.production.min.js +0.85% 29.79 kB 30.04 kB +0.92% 9.99 kB 10.08 kB
oss-stable-semver/react-server/cjs/react-server-flight.development.js +0.61% 66.37 kB 66.77 kB +0.90% 16.30 kB 16.44 kB
oss-stable/react-server/cjs/react-server-flight.development.js +0.61% 66.37 kB 66.77 kB +0.90% 16.30 kB 16.44 kB
oss-experimental/react-server/cjs/react-server-flight.development.js +0.57% 70.55 kB 70.96 kB +0.68% 16.93 kB 17.05 kB
oss-stable-semver/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.40% 100.39 kB 100.79 kB +0.65% 24.02 kB 24.18 kB
oss-stable/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.40% 100.39 kB 100.79 kB +0.65% 24.02 kB 24.18 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.39% 102.66 kB 103.07 kB +0.65% 24.91 kB 25.07 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.39% 102.66 kB 103.07 kB +0.65% 24.91 kB 25.07 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.39% 103.07 kB 103.48 kB +0.62% 25.03 kB 25.18 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.39% 103.07 kB 103.48 kB +0.62% 25.03 kB 25.18 kB
oss-experimental/react-server-dom-esm/cjs/react-server-dom-esm-server.node.development.js +0.38% 104.80 kB 105.21 kB +0.52% 24.79 kB 24.91 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.38% 105.14 kB 105.54 kB +0.60% 25.59 kB 25.75 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.38% 105.14 kB 105.54 kB +0.60% 25.59 kB 25.75 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.38% 105.25 kB 105.65 kB +0.63% 25.64 kB 25.80 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.38% 105.25 kB 105.65 kB +0.63% 25.64 kB 25.80 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.38% 105.80 kB 106.20 kB +0.63% 25.25 kB 25.41 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.38% 105.80 kB 106.20 kB +0.63% 25.25 kB 25.41 kB
oss-stable-semver/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +0.38% 108.54 kB 108.95 kB +0.66% 25.25 kB 25.41 kB
oss-stable/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +0.38% 108.54 kB 108.95 kB +0.66% 25.25 kB 25.41 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.browser.development.js +0.37% 107.53 kB 107.93 kB +0.52% 25.80 kB 25.94 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js +0.37% 107.94 kB 108.34 kB +0.51% 25.93 kB 26.06 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.37% 108.22 kB 108.63 kB +0.61% 25.87 kB 26.03 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.37% 108.22 kB 108.63 kB +0.61% 25.87 kB 26.03 kB
oss-stable-semver/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.37% 108.44 kB 108.84 kB +0.60% 26.12 kB 26.28 kB
oss-stable/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.37% 108.44 kB 108.84 kB +0.60% 26.12 kB 26.28 kB
oss-stable-semver/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +0.37% 111.26 kB 111.68 kB +0.65% 25.99 kB 26.16 kB
oss-stable/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +0.37% 111.26 kB 111.68 kB +0.65% 25.99 kB 26.16 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.development.js +0.37% 110.00 kB 110.40 kB +0.50% 26.49 kB 26.62 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.browser.development.js +0.37% 110.11 kB 110.51 kB +0.51% 26.53 kB 26.66 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.unbundled.development.js +0.37% 110.21 kB 110.62 kB +0.51% 26.01 kB 26.14 kB
oss-stable-semver/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.36% 110.86 kB 111.26 kB +0.59% 26.78 kB 26.94 kB
oss-stable/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.36% 110.86 kB 111.26 kB +0.59% 26.78 kB 26.94 kB
oss-experimental/react-server-dom-turbopack/umd/react-server-dom-turbopack-server.browser.development.js +0.36% 113.64 kB 114.05 kB +0.64% 26.10 kB 26.27 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.unbundled.development.js +0.36% 112.64 kB 113.04 kB +0.49% 26.64 kB 26.77 kB
oss-experimental/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js +0.36% 112.86 kB 113.26 kB +0.49% 26.84 kB 26.98 kB
oss-experimental/react-server-dom-webpack/umd/react-server-dom-webpack-server.browser.development.js +0.35% 116.36 kB 116.77 kB +0.63% 26.84 kB 27.01 kB
oss-experimental/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js +0.35% 115.27 kB 115.68 kB +0.48% 27.51 kB 27.64 kB
oss-experimental/react/cjs/react.shared-subset.development.js = 86.61 kB 86.16 kB = 24.09 kB 23.93 kB
oss-stable/react/cjs/react.shared-subset.development.js = 84.95 kB 84.51 kB = 23.62 kB 23.46 kB
oss-stable-semver/react/cjs/react.shared-subset.development.js = 84.93 kB 84.48 kB = 23.59 kB 23.42 kB
oss-experimental/react/cjs/react.shared-subset.production.min.js = 8.46 kB 8.40 kB = 3.47 kB 3.45 kB
oss-stable/react/cjs/react.shared-subset.production.min.js = 7.94 kB 7.89 kB = 3.32 kB 3.29 kB
oss-stable-semver/react/cjs/react.shared-subset.production.min.js = 7.92 kB 7.86 kB = 3.29 kB 3.27 kB
oss-experimental/react/umd/react.development.js = 125.73 kB 107.24 kB = 32.51 kB 27.83 kB
oss-stable/react/umd/react.development.js = 123.16 kB 104.66 kB = 31.89 kB 27.20 kB
oss-stable-semver/react/umd/react.development.js = 123.13 kB 104.64 kB = 31.86 kB 27.17 kB
oss-experimental/react/umd/react.production.min.js = 13.02 kB 9.21 kB = 4.99 kB 3.52 kB
oss-experimental/react/umd/react.profiling.min.js = 13.01 kB 9.21 kB = 4.99 kB 3.52 kB
oss-stable/react/umd/react.production.min.js = 12.13 kB 8.32 kB = 4.72 kB 3.24 kB
oss-stable/react/umd/react.profiling.min.js = 12.13 kB 8.32 kB = 4.72 kB 3.24 kB
oss-stable-semver/react/umd/react.production.min.js = 12.10 kB 8.30 kB = 4.69 kB 3.21 kB
oss-stable-semver/react/umd/react.profiling.min.js = 12.10 kB 8.30 kB = 4.69 kB 3.21 kB

Generated by 🚫 dangerJS against 63064a6

I do this by simply renaming the secret export name in that bundle.
Like ReactDebugCurrentFrame. So we preserve those simple cases on
the old name while still moving dispatcher and cache to the separate one.
@sebmarkbage sebmarkbage merged commit c7ba8c0 into facebook:main Sep 29, 2023
2 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 29, 2023
I do this by simply renaming the secret export name in the "subset"
bundle and this renamed version is what the FlightServer uses.

This requires us to be more diligent about always using the correct
instance of "react" in our tests so there's a bunch of clean up for
that.

DiffTrain build for [c7ba8c0](c7ba8c0)
ztanner added a commit to vercel/next.js that referenced this pull request Oct 16, 2023
…experimental prefix for server action APIs (#56809)

The latest React canary builds have a few changes that need to be
adopted for compatability.

1. the `useFormState` and `useFormStatus` hooks in `react-dom` and the
`formData` opiont in `react-dom/server` are no longer prefixed with
`experimental_`
2. server content (an undocumented React feature) has been removed. Next
only had trivial intenral use of this API and did not expose a coherent
feature to Next users (no ability to seed context on refetches). It is
still possible that some users used the React server context APIs which
is why this should go into Next 14.

### React upstream changes

- facebook/react#27513
- facebook/react#27514
- facebook/react#27511
- facebook/react#27508
- facebook/react#27502
- facebook/react#27474
- facebook/react#26789
- facebook/react#27500
- facebook/react#27488
- facebook/react#27458
- facebook/react#27471
- facebook/react#27470
- facebook/react#27464
- facebook/react#27456
- facebook/react#27462
- facebook/react#27461
- facebook/react#27460
- facebook/react#27459
- facebook/react#27454
- facebook/react#27457
- facebook/react#27453
- facebook/react#27401
- facebook/react#27443
- facebook/react#27445
- facebook/react#27364
- facebook/react#27440
- facebook/react#27436

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
@ryanto
Copy link

ryanto commented Oct 30, 2023

Hey @sebmarkbage I've got a question about this PR.

In my hobby RSC implementation (prior to this PR) I was rendering both the RSC tree and then the SSR tree in the same process. Something along the lines of:

let rscStream = renderToReadableStream(
  createElement(ServerComponent),
  clientComponentMap
);

let rscTree = createFromReadableStream(rscStream);

let htmlStream = await ReactDom.renderToReadableStream(
  createElement(SSRRouter, {
    path: pathname,
    rscTree: rscTree
  })
});

return new Response(htmlStream);

But if I use --conditions react-server then my ReactDom.renderToReadableStream doesn't work because it's getting the react-server React subset.

I'm guessing my prior approach was wrong and this PR means I should be doing the SSR render in something like a Node worker that doesn't use --conditions react-server. Figured I'd ask here just to make sure I'm on the right track?

Thanks in advance :)

jackpope added a commit that referenced this pull request Nov 17, 2023
## Summary

After changes in #27436, UMD
builds no longer expose Scheduler from ReactSharedInternals. This module
is forked in rollup for UMD builds and the path no longer matches. This
PR updates the path name to match the new module:
ReactSharedInternalsClient.

## How did you test this change?

- `yarn build`
- Inspect `react.development.js` UMD build, observe `Scheduler:
Scheduler` is set in `ReactSharedInternals`, matching
[18.2.0](https://unpkg.com/react@18.2.0/umd/react.development.js)
- ran attribute-behavior fixture app
- Observe no more error `Uncaught (in promise) TypeError: Cannot read
properties of undefined (reading 'unstable_cancelCallback')`

Co-authored-by: Jack Pope <jackpope@meta.com>
@Chechengyi
Copy link

Hey @sebmarkbage I've got a question about this PR.

In my hobby RSC implementation (prior to this PR) I was rendering both the RSC tree and then the SSR tree in the same process. Something along the lines of:

let rscStream = renderToReadableStream(
  createElement(ServerComponent),
  clientComponentMap
);

let rscTree = createFromReadableStream(rscStream);

let htmlStream = await ReactDom.renderToReadableStream(
  createElement(SSRRouter, {
    path: pathname,
    rscTree: rscTree
  })
});

return new Response(htmlStream);

But if I use --conditions react-server then my ReactDom.renderToReadableStream doesn't work because it's getting the react-server React subset.

I'm guessing my prior approach was wrong and this PR means I should be doing the SSR render in something like a Node worker that doesn't use --conditions react-server. Figured I'd ask here just to make sure I'm on the right track?

Thanks in advance :)

I encountered a similar problem when I upgraded the react version from 18.3.0-next-1308e49a6-20230330 to 18.3.0-canary-1d5667a12-20240102.

The wrong content is here: #27478

So I think. Two processes should be used to run the ssr service and rsc service.

like this:

SERVER_TARGET=rsc nodemon --conditions react-server server
SERVER_TARGET=ssr nodemon server

jtoar added a commit to redwoodjs/redwood that referenced this pull request Mar 17, 2024
Want to see how CI reacts to upgrading to React canary. ~I may have
over-upgraded (i.e. some fixtures and maybe the docs don't need to be
upgraded), but let's see what happens.~

This upgrade was complicated by
facebook/react#27436 which added a poisoned
import to `react-server-dom-webpack/server`, meaning that if you tried
to import from that entry point without the "react-server" condition, it
would throw.

In a much-earlier PR, Sebastian mentions there generally being two ways
to do things:

> Either you can have the server code prebundled using Webpack (what
Next.js does in practice) or you can use an unbundled Node.js server
(what the reference implementation does).

See facebook/react#26172.

This PR goes with the former, prebundling
`react-server-dom-webpack/server` with the "react-server" condition so
that we can avoid having to specify it at runtime. It's hard to tell if
this the better option long-term, but since we're keen on getting rid of
the worker right now, this moves us closer in that direction. The
alternative solution was to move decoding the reply into the worker
where the condition is specified.

---------

Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
)

I do this by simply renaming the secret export name in the "subset"
bundle and this renamed version is what the FlightServer uses.

This requires us to be more diligent about always using the correct
instance of "react" in our tests so there's a bunch of clean up for
that.
EdisonVan pushed a commit to EdisonVan/react that referenced this pull request Apr 15, 2024
## Summary

After changes in facebook#27436, UMD
builds no longer expose Scheduler from ReactSharedInternals. This module
is forked in rollup for UMD builds and the path no longer matches. This
PR updates the path name to match the new module:
ReactSharedInternalsClient.

## How did you test this change?

- `yarn build`
- Inspect `react.development.js` UMD build, observe `Scheduler:
Scheduler` is set in `ReactSharedInternals`, matching
[18.2.0](https://unpkg.com/react@18.2.0/umd/react.development.js)
- ran attribute-behavior fixture app
- Observe no more error `Uncaught (in promise) TypeError: Cannot read
properties of undefined (reading 'unstable_cancelCallback')`

Co-authored-by: Jack Pope <jackpope@meta.com>
bigfootjon pushed a commit that referenced this pull request Apr 18, 2024
I do this by simply renaming the secret export name in the "subset"
bundle and this renamed version is what the FlightServer uses.

This requires us to be more diligent about always using the correct
instance of "react" in our tests so there's a bunch of clean up for
that.

DiffTrain build for commit c7ba8c0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants