Skip to content

feat(plugin-rsc): expose Node.js stream APIs#1164

Open
restareaByWeezy wants to merge 1 commit intovitejs:mainfrom
restareaByWeezy:fix/plugin-rsc-node-stream-apis
Open

feat(plugin-rsc): expose Node.js stream APIs#1164
restareaByWeezy wants to merge 1 commit intovitejs:mainfrom
restareaByWeezy:fix/plugin-rsc-node-stream-apis

Conversation

@restareaByWeezy
Copy link
Copy Markdown

@restareaByWeezy restareaByWeezy commented Mar 26, 2026

Closes #1162

The vendored react-server-dom packages include Node.js stream APIs that are faster than their Web Streams equivalents on Node.js, but they weren't exposed by plugin-rsc. This adds separate entry points for them.

What's added

New entry points that mirror the existing rsc and ssr entries but use Node.js streams:

// RSC server — pipeable Node.js stream
import { renderToPipeableStream } from '@vitejs/plugin-rsc/rsc.node'

// SSR client — consume Flight data from a Node.js Readable
import { createFromNodeStream } from '@vitejs/plugin-rsc/ssr.node'

Both entry points also re-export the Web Streams variants (renderToReadableStream, createFromReadableStream) so you can switch entry points without losing access to the existing APIs.

The existing Web Streams exports (@vitejs/plugin-rsc/rsc, @vitejs/plugin-rsc/ssr) are unchanged.

Files

  • src/react/rsc.node.ts — low-level Node.js RSC server APIs (imports from server.node)
  • src/react/ssr.node.ts — low-level Node.js SSR client APIs (imports from client.node)
  • src/rsc.node.tsx — runtime RSC entry with renderToPipeableStream + manifest wiring
  • src/ssr.node.tsx — runtime SSR entry with createFromNodeStream + preload/proxy wiring
  • tsdown.config.ts — added new entry points to build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant