GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(plugin-rsc): expose Node.js stream APIs by switz · Pull Request #1276 · vitejs/vite-plugin-react

Conversation

@switz

@switz switz commented Jul 6, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Edit: Apologies, Claude went ahead and opened this PR automatically. This code was driven with Claude.

This closes my issue #1162 and addresses the feedback from the PR in #1164

Let me know if you want me to make any changes. Sorry for the quick trigger on the PR.

The flaw here is dual loading edge and node apis on the node path – if we want to refactor it, we can drop that. You'd know better than me if that's a big deal.


Closes #1162

The vendored react-server-dom-webpack package includes Node.js stream APIs (renderToPipeableStream, createFromNodeStream) that are faster than their Web Streams equivalents on Node.js, but they weren't exposed by @vitejs/plugin-rsc.

Approach

The server.node and client.node variants from react-server-dom-webpack are supersets of their .edge counterparts. So each new .node file re-exports everything from the existing edge-based module and adds only the Node.js-specific delta — no code duplication.

New entry points:

import { renderToPipeableStream } from '@vitejs/plugin-rsc/rsc.node'
import { createFromNodeStream } from '@vitejs/plugin-rsc/ssr.node'

Both also re-export all existing Web Streams APIs, so consumers can switch entry points without losing access to renderToReadableStream / createFromReadableStream.

Files

New (4 files):

  • src/react/rsc.node.ts — low-level wrapper, re-exports ./rsc + adds renderToPipeableStream
  • src/react/ssr.node.ts — low-level wrapper, re-exports ./ssr + adds createFromNodeStream
  • src/rsc.node.tsx — high-level entry, re-exports ./rsc + adds wrapped renderToPipeableStream with asset manifest enrichment
  • src/ssr.node.tsx — high-level entry, re-exports ./ssr + adds createFromNodeStream

Modified (2 files):

  • tsdown.config.ts — added 4 new entry points
  • src/types/index.ts — added PipeableStream, RenderToPipeableStreamOptions, CreateFromNodeStreamOptions

No changes to package.json (wildcard export covers new paths) or plugin.ts (vendor alias already handles .node variants).

Test plan

  • pnpm build compiles successfully with new entry points
  • tsc -b ./tsconfig.json passes
  • E2E test exercising the Node.js stream APIs (happy to add — would appreciate guidance on preferred approach, e.g. inline fixture variant of starter-extra that swaps the SSR entry to use createFromNodeStream)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hi-ogawa
hi-ogawa requested changes Aug 5, 2026
View reviewed changes

@hi-ogawa hi-ogawa left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

Thanks for PR. There has been some update on current /rsc structure https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-rsc/README.md#rsc-runtime-react-server-dom-api Can you align these node variant with new structure and API like:

  • /rsc.node
  • /rsc/server.node
  • /rsc/client.node
  • /rsc/static.node

Having an e2e would be also desired. A dedicated starter-like example under examples/node-stream could work. I have reworked test guidance a bit recently so please take a look https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-rsc/CONTRIBUTING.md#testing

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
switz and others added 2 commits August 16, 2026 10:40
@switz @claude
feat(plugin-rsc): expose Node.js stream APIs (renderToPipeableStream,…
7cc7923
… createFromNodeStream)

Re-export Node.js-native stream variants from react-server-dom-webpack
as new entry points (@vitejs/plugin-rsc/rsc.node, ssr.node) without
duplicating existing code — each .node file re-exports from its edge
counterpart and adds only the Node-specific APIs.

Closes vitejs#1162

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@switz @claude
refactor(plugin-rsc): align Node.js stream APIs with sub-path structure
b1baf48
Restructure Node.js stream entry points from flat paths (/rsc.node,
/ssr.node) to match the existing sub-path pattern:
- /rsc/server.node (renderToPipeableStream)
- /rsc/client.node (createFromNodeStream)
- /rsc/static.node (prerenderToNodeStream)
- /rsc.node (barrel re-export of server.node + client.node)

Add .node vendor subpaths to optimizeDeps.include so CJS vendor files
are properly pre-bundled in dev mode.

Add examples/node-stream demonstrating Node.js stream APIs with an
e2e test covering both dev and build modes.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@switz
switz force-pushed the feat/rsc-node-stream-apis branch from 7747f53 to b1baf48 Compare August 16, 2026 15:15
@switz
switz requested a review from hi-ogawa August 16, 2026 15:16
@switz

switz commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Rebased the branch and updated everything based on your feedback. Node stream apis are now aligned with the sub-path pattern.

Also added an e2e test. Thanks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

hi-ogawa and others added 12 commits August 17, 2026 10:15
@hi-ogawa OpenCode
feat(plugin-rsc): complete Node stream example
4c289c8
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
test(plugin-rsc): align Node stream app with starter
ed3dd93
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
docs(plugin-rsc): document Node stream APIs
62c3e0b
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
refactor(plugin-rsc): isolate Node stream runtimes
df68f35
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
refactor(plugin-rsc): share RSC client manifest setup
173581c
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
feat(plugin-rsc): expose Busboy reply decoding
d4d93c2
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
test(plugin-rsc): reuse starter action coverage
c6d06d1
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
refactor(plugin-rsc): stream progressive action forms
3550001
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa
nit
b1a2483
@hi-ogawa OpenCode
docs(plugin-rsc): link Node stream type references
57f388d
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa
nit
824b256
@hi-ogawa
nit
6a323bb
hi-ogawa
hi-ogawa reviewed Aug 17, 2026
View reviewed changes
Comment thread packages/plugin-rsc/src/types/index.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@hi-ogawa OpenCode
fix(plugin-rsc): distinguish stream option types
67ef614
Co-authored-by: OpenCode <[email protected]>
hi-ogawa
hi-ogawa reviewed Aug 17, 2026
View reviewed changes
Comment thread packages/plugin-rsc/src/react/rsc/static.node.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

hi-ogawa
hi-ogawa reviewed Aug 17, 2026
View reviewed changes
Comment thread packages/plugin-rsc/src/ssr/shared.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

hi-ogawa and others added 7 commits August 17, 2026 11:25
@hi-ogawa OpenCode
fix(plugin-rsc): keep source map lookup internal
46529e0
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa OpenCode
refactor(plugin-rsc): centralize prerender result type
fd02d2c
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa
nit
1a0b9ba
@hi-ogawa OpenCode
fix(plugin-rsc): expose web streams from node entries
f181ff5
Co-authored-by: OpenCode <[email protected]>
@hi-ogawa
nit
e0bc93e
@hi-ogawa
nit
f4147bb
@hi-ogawa
nit
cdac614
hi-ogawa
hi-ogawa approved these changes Aug 17, 2026
View reviewed changes

@hi-ogawa hi-ogawa left a comment

Copy link
Copy Markdown
Contributor

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 have extended node stream entries to @vitejs/plugin-rsc/ssr.node too. examples/node-stream is also extended to exercise node stream workflow end to end accordingly.

The re-exports from edge to node is eliminated by copying own wrapper code on node variant entries.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hi-ogawa OpenCode
fix(plugin-rsc): scope node dependency optimization
a27ac7d
Co-authored-by: OpenCode <[email protected]>
hi-ogawa
hi-ogawa reviewed Aug 17, 2026
View reviewed changes
Comment thread packages/plugin-rsc/examples/node-stream/vite.config.ts
Comment on lines +9 to +14
rsc: {
optimizeDeps: {
include: [
'@vitejs/plugin-rsc/vendor/react-server-dom/server.node',
'@vitejs/plugin-rsc/vendor/react-server-dom/static.node',
'@vitejs/plugin-rsc/vendor/react-server-dom/client.node',

@hi-ogawa hi-ogawa Aug 17, 2026

Copy link
Copy Markdown
Contributor

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.

Moved the node vendor optimizeDeps.include to example level configuration since always adding optimized node import from plugin can cause issues on non-node environment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hi-ogawa
hi-ogawa merged commit 32105d5 into vitejs:main Aug 17, 2026
19 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@vite-release-bot vite-release-bot Bot mentioned this pull request Sep 16, 2026
release: [email protected] #1459
Merged
@james-elicx james-elicx mentioned this pull request Nov 20, 2026
feat(rsc): add reactServerDomBuild option to use React's Node builds of react-server-dom #1572
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hi-ogawa hi-ogawa hi-ogawa approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

@vitejs/plugin-rsc — expose Node.js stream APIs (renderToPipeableStream, createFromNodeStream)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@switz @hi-ogawa
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.