Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
react-dom/server.browser
in Node.js (#33950)
Instead of branching rendering based on Node.js and browser/web runtimes, we should just use the web version for now, which can run as-is on versions >=16.5.0 of Node.js, polyfilling `ReadableStream` on older versions when necessary. There are a few potential downsides to this, as React is less able to optimize flushing and execution. We can revisit that in the future though if desired.
- Loading branch information
Showing
9 changed files
with
201 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { ReadableStream } from './web/sandbox/readable-stream' | ||
|
||
// Polyfill ReadableStream in the Node.js environment | ||
if (!global.ReadableStream) { | ||
global.ReadableStream = ReadableStream | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
0b1d5e1
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.
Stats from current release
Default Build (Increase detected⚠️ )
General Overall increase⚠️
Page Load Tests Overall increase ✓
Client Bundles (main, webpack, commons) Overall increase⚠️
Legacy Client Bundles (polyfills)
Client Pages Overall decrease ✓
Client Build Manifests
Rendered Page Sizes Overall decrease ✓
Diffs
Diff for _buildManifest.js
Diff for image-HASH.js
Diff for main-HASH.js
Diff for index.html
Diff for link.html
Diff for withRouter.html
Default Build with SWC (Increase detected⚠️ )
General Overall increase⚠️
Page Load Tests Overall increase ✓
Client Bundles (main, webpack, commons) Overall increase⚠️
Legacy Client Bundles (polyfills)
Client Pages Overall decrease ✓
Client Build Manifests
Rendered Page Sizes Overall decrease ✓
Diffs
Diff for _buildManifest.js
Diff for image-HASH.js
Diff for main-HASH.js
Diff for index.html
Diff for link.html
Diff for withRouter.html