Skip to content

chore(rsc): update vite-rsc for automatic server css support #13826

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

Open
wants to merge 3 commits into
base: rsc
Choose a base branch
from
Open
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
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.2",
"@hiogawa/vite-rsc": "0.4.4",
"@types/express": "^5.0.0",
"@types/node": "^22.13.1",
"@types/react": "^19.1.8",
Expand Down
4 changes: 2 additions & 2 deletions integration/helpers/rsc-vite/src/entry.rsc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export async function callServer(request: Request) {
}

export default async function handler(request: Request) {
const ssr = await import.meta.viteRsc.loadSsrModule<
const ssr = await import.meta.viteRsc.loadModule<
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
typeof import("./entry.ssr")
>("index");
>("ssr", "index");
return ssr.default(request, callServer);
}
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.2",
"@hiogawa/vite-rsc": "0.4.4",
"@types/express": "^5.0.0",
"@types/node": "^22.13.1",
"@types/react": "^19.1.8",
Expand Down
4 changes: 2 additions & 2 deletions playground/rsc-vite/src/entry.rsc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export async function callServer(request: Request) {
}

export default async function handler(request: Request) {
const ssr = await import.meta.viteRsc.loadSsrModule<
const ssr = await import.meta.viteRsc.loadModule<
typeof import("./entry.ssr")
>("index");
>("ssr", "index");
return ssr.default(request, callServer);
}
1 change: 0 additions & 1 deletion playground/rsc-vite/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export const routes = [
{
id: "root",
path: "",
// requiredCSS: ["/index.css"],
lazy: () => import("./routes/root/root"),
children: [
{
Expand Down
4 changes: 4 additions & 0 deletions playground/rsc-vite/src/routes/home/home.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.server-box-home {
border: 1px solid black;
padding: 10px;
}
4 changes: 3 additions & 1 deletion playground/rsc-vite/src/routes/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Counter } from "../../counter";
import { redirect } from "react-router/rsc";
import type { LoaderFunctionArgs } from "react-router";

import "./home.css";

export async function loader({ request }: LoaderFunctionArgs) {
await new Promise((r) => setTimeout(r, 500));
return {
Expand Down Expand Up @@ -39,7 +41,7 @@ export default function HomeRoute({
};

return (
<div style={{ border: "1px solid black", padding: "10px" }}>
<div className="server-box-home">
<h2>Home Route</h2>
<p>Loader data: {message}</p>
<Counter />
Expand Down
1 change: 0 additions & 1 deletion playground/rsc-vite/src/routes/root/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export function Layout({ children }: { children: React.ReactNode }) {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>React Server</title>
<Links />
{import.meta.viteRsc.loadCss()}
</head>
<body>
<div className="server-box">
Expand Down
29 changes: 18 additions & 11 deletions pnpm-lock.yaml

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