Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
renderToReadableStream
✓ import { renderToReadableStream } from 'react-server-dom-bun/server';
✗ const { renderToReadableStream } = require('react-server-dom-bun/server');
Used by meta-frameworks to render React Server Components to a stream on the server. The package is not for direct application use.
decodeReply
✓ import { decodeReply } from 'react-server-dom-bun/client';
✗ import { decodeReply } from 'react-server-dom-bun';
Intended for internal use by meta-frameworks to parse client-to-server communication for Server Actions. Note the `/client` subpath.
createFromReadableStream
✓ import { createFromReadableStream } from 'react-server-dom-bun/client';
✗ import { createFromReadableStream } from 'react-server-dom-bun/server';
Used internally by meta-frameworks on the client-side to hydrate React Server Components from a readable stream. Requires the `/client` subpath.
Illustrates how a meta-framework might internally use `renderToReadableStream` to serve a React Server Component with Bun. Not intended for direct app use.
import { renderToReadableStream } from 'react-server-dom-bun/server';
// IMPORTANT: This package is NOT for direct application use.
// This quickstart demonstrates how a meta-framework *might* internally
// use react-server-dom-bun to render a React Server Component.
// Assume a simple Server Component for demonstration
function App() {
return (
<html>
<head>
<title>Bun RSC Demo</title>
</head>
<body>
<h1>Hello from React Server Component on Bun!</h1>
<p>Current time: {new Date().toLocaleTimeString()}</p>
</body>
</html>
);
}
// A simplified Bun server implementation for illustration purposes.
// In a real meta-framework, this would be part of a much larger setup.
const server = Bun.serve({
port: 3000,
async fetch(req: Request) {
const url = new URL(req.url);
if (url.pathname === '/') {
const stream = await renderToReadableStream(<App />);
return new Response(stream, {
headers: { 'Content-Type': 'text/html' }
});
}
// Serve static assets (e.g., a client bundle if one existed)
if (url.pathname.startsWith('/src')) {
try {
const filePath = `.${url.pathname}`;
return new Response(Bun.file(filePath));
} catch (error) {
console.error(`Error serving static file: ${url.pathname}`, error);
return new Response('Not Found', { status: 404 });
}
}
return new Response('Not Found', { status: 404 });
},
});
console.log(`Bun Server Components server running on http://localhost:${server.port}`);
Debug
Known issues
breakingThis package is explicitly marked `0.0.0-experimental`. Its API is highly unstable, subject to frequent breaking changes, and not guaranteed to maintain backwards compatibility.fixAvoid direct reliance on this package for application-level code. Treat it as an internal implementation detail for meta-frameworks only.
affects: >=0.0.0-experimental-0
gotchaThe package description explicitly states: 'It is not intended to be imported directly.' Application developers should not use this package, but rather consume its functionality indirectly through a meta-framework that integrates React Server Components.fixIf you are not building a meta-framework, use a framework like Next.js, Remix, or others that provide React Server Components integration out-of-the-box.
affects: >=0.0.0-experimental-0
breakingRecent releases include critical security and stability patches, such as 'DoS mitigations to Server Actions' and 'cycle protections'. This indicates that previous experimental versions may have had vulnerabilities or instability, which are actively being addressed.fixMeta-frameworks should ensure they are using the absolute latest experimental versions of `react-server-dom-bun` to benefit from the most recent security and stability improvements.
affects: <=19.2.4
gotchaThis package is specifically designed for the Bun runtime. Attempting to use it in Node.js or other JavaScript runtimes is unlikely to work correctly and may lead to runtime errors or unexpected behavior.fixEnsure your project is configured to run with Bun if you are developing or testing a meta-framework that utilizes `react-server-dom-bun`.
affects: >=0.0.0-experimental-0
Errors
Common errors & fixes
Error: This package is experimental and not intended for direct use.
Attempting to import or use `react-server-dom-bun` directly in an application, rather than through a meta-framework.
fixIntegrate React Server Components via a supported meta-framework (e.g., Next.js, Remix) that handles this package internally.
TypeError: (0, _react_server_dom_bun_server__WEBPACK_IMPORTED_MODULE_0__.renderToReadableStream) is not a function
Incorrect import path for ESM or CJS, or attempting to use a function that is not exported or available in the specific runtime environment or subpath.
fixVerify the correct import path (`/server` or `/client` subpath) and ensure your bundler/runtime correctly handles ESM imports from `react-server-dom-bun`.
Invariant Violation: React Server Components require a Bun runtime.
Attempting to run code using `react-server-dom-bun` in a non-Bun environment (e.g., Node.js, Deno).
fixEnsure your server-side rendering environment is configured to use the Bun runtime for projects leveraging this package.
Upgrade
Version history
0.0.0-experimental-603e6108-20241029latest on npm
Audit
Dependencies
No dependency data recorded yet.