Skip to content

chore(rsc): replace @hiogawa/vite-rsc with @vitejs/plugin-rsc #13933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions docs/start/rsc/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ npm i react-router react react-dom react-server-dom-parcel @mjackson/node-fetch-
Along with development dependencies

```shellscript nonumber
npm i -D vite vite-plugin-devtools-json @hiogawa/vite-rsc typescript @types/react @types/react-dom @types/express @types/compression @types/node
npm i -D vite vite-plugin-devtools-json @vitejs/plugin-rsc typescript @types/react @types/react-dom @types/express @types/compression @types/node
```

## Configure Parcel
Expand Down Expand Up @@ -58,7 +58,7 @@ import {
decodeReply,
loadServerAction,
renderToReadableStream,
} from "@hiogawa/vite-rsc/rsc";
} from "@vitejs/plugin-rsc/rsc";
import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";

import { routes } from "./routes/routes";
Expand Down Expand Up @@ -102,18 +102,21 @@ export default async function handler(request: Request) {
Create a `src/prerender.tsx` file that will be responsible for rendering our application to HTML.

```tsx nonnumber
import { createFromReadableStream } from "@hiogawa/vite-rsc/ssr";
import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr";
import { renderToReadableStream as renderHTMLToReadableStream } from "react-dom/server.edge";
import {
unstable_routeRSCServerRequest as routeRSCServerRequest,
unstable_RSCStaticRouter as RSCStaticRouter,
} from "react-router";
import bootstrapScriptContent from "virtual:vite-rsc/bootstrap-script-content";

export async function prerender(
request: Request,
fetchServer: (request: Request) => Promise<Response>
): Promise<Response> {
const bootstrapScriptContent =
await import.meta.viteRsc.loadBootstrapScriptContent(
"index"
);
return await routeRSCServerRequest({
// The incoming request.
request,
Expand Down Expand Up @@ -151,7 +154,7 @@ import {
createFromReadableStream,
encodeReply,
setServerCallback,
} from "@hiogawa/vite-rsc/browser";
} from "@vitejs/plugin-rsc/browser";
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
import {
Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/rsc-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"typecheck": "tsc"
},
"devDependencies": {
"@hiogawa/vite-rsc": "0.4.4",
"@vitejs/plugin-rsc": "0.4.10-alpha.1",
"@types/express": "^5.0.0",
"@types/node": "^22.13.1",
"@types/react": "^19.1.8",
Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/rsc-vite/src/entry.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createTemporaryReferenceSet,
encodeReply,
setServerCallback,
} from "@hiogawa/vite-rsc/browser";
} from "@vitejs/plugin-rsc/browser";
import {
unstable_createCallServer as createCallServer,
unstable_getRSCStream as getRSCStream,
Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/rsc-vite/src/entry.rsc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
decodeReply,
loadServerAction,
renderToReadableStream,
} from "@hiogawa/vite-rsc/rsc";
} from "@vitejs/plugin-rsc/rsc";
import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";

import { routes } from "./routes";
Expand Down
5 changes: 3 additions & 2 deletions integration/helpers/rsc-vite/src/entry.ssr.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import bootstrapScriptContent from "virtual:vite-rsc/bootstrap-script-content";
import { createFromReadableStream } from "@hiogawa/vite-rsc/ssr";
import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr";
// @ts-expect-error
import * as ReactDomServer from "react-dom/server.edge";
import {
Expand All @@ -11,6 +10,8 @@ export default async function handler(
request: Request,
fetchServer: (request: Request) => Promise<Response>
) {
const bootstrapScriptContent =
await import.meta.viteRsc.loadBootstrapScriptContent("index");
return routeRSCServerRequest({
request,
fetchServer,
Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/rsc-vite/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"module": "ESNext",
"target": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"types": ["vite/client", "@hiogawa/vite-rsc/types"],
"types": ["vite/client", "@vitejs/plugin-rsc/types"],
"jsx": "react-jsx"
}
}
2 changes: 1 addition & 1 deletion integration/helpers/rsc-vite/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rsc from "@hiogawa/vite-rsc/plugin";
import rsc from "@vitejs/plugin-rsc";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

Expand Down
2 changes: 1 addition & 1 deletion playground/rsc-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"typecheck": "tsc"
},
"devDependencies": {
"@hiogawa/vite-rsc": "0.4.4",
"@vitejs/plugin-rsc": "0.4.10-alpha.1",
"@types/express": "^5.0.0",
"@types/node": "^22.13.1",
"@types/react": "^19.1.8",
Expand Down
2 changes: 1 addition & 1 deletion playground/rsc-vite/src/entry.browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createTemporaryReferenceSet,
encodeReply,
setServerCallback,
} from "@hiogawa/vite-rsc/browser";
} from "@vitejs/plugin-rsc/browser";
import {
unstable_createCallServer as createCallServer,
unstable_getRSCStream as getRSCStream,
Expand Down
2 changes: 1 addition & 1 deletion playground/rsc-vite/src/entry.rsc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
decodeReply,
loadServerAction,
renderToReadableStream,
} from "@hiogawa/vite-rsc/rsc";
} from "@vitejs/plugin-rsc/rsc";
import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";

import { routes } from "./routes";
Expand Down
4 changes: 2 additions & 2 deletions playground/rsc-vite/src/entry.ssr.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import bootstrapScriptContent from "virtual:vite-rsc/bootstrap-script-content";
import { createFromReadableStream } from "@hiogawa/vite-rsc/ssr";
import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr";
// @ts-expect-error
import * as ReactDomServer from "react-dom/server.edge";
import {
Expand All @@ -11,6 +10,7 @@ export default async function handler(
request: Request,
fetchServer: (request: Request) => Promise<Response>
) {
const bootstrapScriptContent = await import.meta.viteRsc.loadBootstrapScriptContent("index");
return routeRSCServerRequest({
request,
fetchServer,
Expand Down
2 changes: 1 addition & 1 deletion playground/rsc-vite/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"module": "ESNext",
"target": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"types": ["vite/client", "@hiogawa/vite-rsc/types"],
"types": ["vite/client", "@vitejs/plugin-rsc/types"],
"jsx": "react-jsx"
}
}
2 changes: 1 addition & 1 deletion playground/rsc-vite/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import rsc from "@hiogawa/vite-rsc/plugin";
import rsc from "@vitejs/plugin-rsc";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

Expand Down
60 changes: 26 additions & 34 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.