Skip to content

Commit

Permalink
chore: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 7, 2024
1 parent 9a756a1 commit 561ec4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion examples/child-process/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# child-process

Running module runner inside child process (e.g. node, bun) with `--conditions react-server`, which allows `react` to be externalized.
Custom environment to run a module runner inside a child process (e.g. node, bun). For example, this allows externalizing `react` deps by running a child process with `--conditions react-server`.

```sh
pnpm dev
```

## todo

- write a summary
- why bridge server instead of vite server middleware
- `dispatchFetch(request)` vs `dispatchFetch(entry, request)`

## related

- https://github.com/netlify/netlify-vite-environment
Expand Down
3 changes: 0 additions & 3 deletions examples/child-process/src/entry-ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React from "react";
import ReactDomServer from "react-dom/server.edge";
import ReactClient from "react-server-dom-webpack/client.edge";
import type { StreamData } from "./entry-rsc";
import type { ChildProcessFetchDevEnvironment } from "./lib/vite/environment";

export default async function handler(request: Request): Promise<Response> {
const url = new URL(request.url);
Expand Down Expand Up @@ -48,8 +47,6 @@ export default async function handler(request: Request): Promise<Response> {
return new Response(ssrStream, { headers: { "content-type": "text/html" } });
}

declare const __vite_environment_rsc__: ChildProcessFetchDevEnvironment;

async function handleRsc(request: Request): Promise<Response> {
return __vite_environment_rsc__.dispatchFetch("/src/entry-rsc.tsx", request);
}
2 changes: 2 additions & 0 deletions examples/child-process/src/lib/ambient.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare const __vite_server: import("vite").ViteDevServer;
declare const __vite_environment_rsc__: import("./vite/environment").ChildProcessFetchDevEnvironment;

0 comments on commit 561ec4a

Please sign in to comment.