brillout / react-streaming

React Streaming. Full-fledged & Easy.
MIT License
220 stars 14 forks source link

could not import `renderToPipeableStream` from `react-dom/server` #19

Closed welpie21 closed 1 year ago

welpie21 commented 1 year ago

Hello, i'm quite new to this library but i have a bit of a problem here to implement renderToStream within deno. When i call renderToStream and pass in the element with option disable: false I get the error that it fails to import renderToPipeableStream from react-dom/server.

currently this is my main.tsx:

/** @jsx h */
/** @jsxFrag Fragment */
import { Application } from "https://deno.land/x/oak@v12.4.0/mod.ts";
import { App } from "./src/App.tsx";
import { h } from "https://deno.land/x/jsx@v0.1.5/mod.ts";
import { renderToStream } from "npm:react-streaming/server";

const app = new Application();

app.use(async (ctx) => {

    const {
        readable
    } = await renderToStream(<App />, {
        disable: true
    });

    ctx.response.body = readable;
});

await app.listen({ port: 8000 });

the app component looks like this:

/** @jsx h */
import { h } from "https://deno.land/x/jsx@v0.1.5/mod.ts";

export function App() {

    return <div>
        Hello world
    </div>;
}
brillout commented 1 year ago

I guess that's related to Deno? I'm not familiar with Deno, so PR welcome.

If you can reproduce on Node.js then I'll have a look at it.

Closing the meantime.