Skip to content

Commit 2d872b6

Browse files
committed
chore(rsc): update vite-rsc to use css export transform
1 parent 7883ba8 commit 2d872b6

File tree

6 files changed

+39
-8
lines changed

6 files changed

+39
-8
lines changed

playground/rsc-vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"typecheck": "tsc"
1010
},
1111
"devDependencies": {
12-
"@hiogawa/vite-rsc": "0.4.2",
12+
"@hiogawa/vite-rsc": "0.4.3",
1313
"@types/express": "^5.0.0",
1414
"@types/node": "^22.13.1",
1515
"@types/react": "^19.1.8",

playground/rsc-vite/src/routes.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ export const routes = [
44
{
55
id: "root",
66
path: "",
7-
// requiredCSS: ["/index.css"],
8-
lazy: () => import("./routes/root/root"),
7+
// @ts-expect-error
8+
lazy: () => import("./routes/root/root?vite-rsc-css-export=Layout"),
99
children: [
1010
{
1111
id: "home",
1212
index: true,
1313
// @ts-expect-error
14-
lazy: () => import("./routes/home/home"),
14+
lazy: () => import("./routes/home/home?vite-rsc-css-export=default"),
1515
},
1616
{
1717
id: "about",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.server-box-home {
2+
border: 1px solid black;
3+
padding: 10px;
4+
}

playground/rsc-vite/src/routes/home/home.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Counter } from "../../counter";
55
import { redirect } from "react-router/rsc";
66
import type { LoaderFunctionArgs } from "react-router";
77

8+
import "./home.css";
9+
810
export async function loader({ request }: LoaderFunctionArgs) {
911
await new Promise((r) => setTimeout(r, 500));
1012
return {
@@ -39,7 +41,7 @@ export default function HomeRoute({
3941
};
4042

4143
return (
42-
<div style={{ border: "1px solid black", padding: "10px" }}>
44+
<div className="server-box-home">
4345
<h2>Home Route</h2>
4446
<p>Loader data: {message}</p>
4547
<Counter />

playground/rsc-vite/src/routes/root/root.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export function Layout({ children }: { children: React.ReactNode }) {
6464
<meta name="viewport" content="width=device-width, initial-scale=1" />
6565
<title>React Server</title>
6666
<Links />
67-
{import.meta.viteRsc.loadCss()}
6867
</head>
6968
<body>
7069
<div className="server-box">

pnpm-lock.yaml

Lines changed: 28 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)