diff --git a/integration/helpers/rsc-vite/package.json b/integration/helpers/rsc-vite/package.json index 12413185f1..63a3845959 100644 --- a/integration/helpers/rsc-vite/package.json +++ b/integration/helpers/rsc-vite/package.json @@ -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", diff --git a/integration/helpers/rsc-vite/src/entry.rsc.tsx b/integration/helpers/rsc-vite/src/entry.rsc.tsx index ebd05d15de..e40f1105d3 100644 --- a/integration/helpers/rsc-vite/src/entry.rsc.tsx +++ b/integration/helpers/rsc-vite/src/entry.rsc.tsx @@ -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); } diff --git a/playground/rsc-vite/package.json b/playground/rsc-vite/package.json index aef4b95daa..2ab6f7f2f5 100644 --- a/playground/rsc-vite/package.json +++ b/playground/rsc-vite/package.json @@ -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", diff --git a/playground/rsc-vite/src/entry.rsc.tsx b/playground/rsc-vite/src/entry.rsc.tsx index 81ccd57670..4cf98c9655 100644 --- a/playground/rsc-vite/src/entry.rsc.tsx +++ b/playground/rsc-vite/src/entry.rsc.tsx @@ -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); } diff --git a/playground/rsc-vite/src/routes.ts b/playground/rsc-vite/src/routes.ts index 822b676180..0367990db7 100644 --- a/playground/rsc-vite/src/routes.ts +++ b/playground/rsc-vite/src/routes.ts @@ -4,7 +4,6 @@ export const routes = [ { id: "root", path: "", - // requiredCSS: ["/index.css"], lazy: () => import("./routes/root/root"), children: [ { diff --git a/playground/rsc-vite/src/routes/home/home.css b/playground/rsc-vite/src/routes/home/home.css new file mode 100644 index 0000000000..f9efbb7f8f --- /dev/null +++ b/playground/rsc-vite/src/routes/home/home.css @@ -0,0 +1,4 @@ +.server-box-home { + border: 1px solid black; + padding: 10px; +} diff --git a/playground/rsc-vite/src/routes/home/home.tsx b/playground/rsc-vite/src/routes/home/home.tsx index 89e1234b8a..f1c11ddeff 100644 --- a/playground/rsc-vite/src/routes/home/home.tsx +++ b/playground/rsc-vite/src/routes/home/home.tsx @@ -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 { @@ -39,7 +41,7 @@ export default function HomeRoute({ }; return ( -
+

Home Route

Loader data: {message}

diff --git a/playground/rsc-vite/src/routes/root/root.tsx b/playground/rsc-vite/src/routes/root/root.tsx index af07cd1a21..8f45e0bc13 100644 --- a/playground/rsc-vite/src/routes/root/root.tsx +++ b/playground/rsc-vite/src/routes/root/root.tsx @@ -64,7 +64,6 @@ export function Layout({ children }: { children: React.ReactNode }) { React Server - {import.meta.viteRsc.loadCss()}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a4ac656f4..8780e6b69e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -547,8 +547,8 @@ importers: version: link:../../../packages/react-router devDependencies: '@hiogawa/vite-rsc': - specifier: 0.4.2 - version: 0.4.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) + specifier: 0.4.4 + version: 0.4.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) '@types/express': specifier: ^5.0.0 version: 5.0.1 @@ -1852,8 +1852,8 @@ importers: version: link:../../packages/react-router devDependencies: '@hiogawa/vite-rsc': - specifier: 0.4.2 - version: 0.4.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) + specifier: 0.4.4 + version: 0.4.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) '@types/express': specifier: ^5.0.0 version: 5.0.1 @@ -3448,11 +3448,11 @@ packages: resolution: {integrity: sha512-AgJgKLooZyQnzMfoFg5Mo/aHM+HGBC9ExpXIjNqGimYTRgNbL/K7X5EM1kR2JY90BNKk9lo6Usq1T/nWFdT7TQ==} hasBin: true - '@hiogawa/transforms@0.1.1': - resolution: {integrity: sha512-NAJ38s8lMMSDv7HOupWt1w5EJ8poMOWPd+JCmmfHg8sdWgFCjCGHnaDi5pTGEBxYLzso9K2urfyK2rW6HORsHw==} + '@hiogawa/transforms@0.1.3': + resolution: {integrity: sha512-vzDCWgXIk4D6Ea2aBSuNqTssN6sTAqm8xzeqXea68o9TvBm5IZhQ3u/8vmWEiJpAtrlTohcTc1Hfgi025iFpGA==} - '@hiogawa/vite-rsc@0.4.2': - resolution: {integrity: sha512-MKHX7B6mqcynBJp9MQQLgMipOavvYIfyhasjZGcJqeMhB8kmGo6QHfRxZheiDo1jGjWHyMsHR1ayHIuMcrK+2w==} + '@hiogawa/vite-rsc@0.4.4': + resolution: {integrity: sha512-Yucbgb6g1bC3S6wofT+ZdtEhnwBZIt4YMZWxXzH9yHugcen0bUtasSATb1qGGraCxu03y8xtHOstXgS8sjdUOQ==} peerDependencies: react: '*' react-dom: '*' @@ -9642,6 +9642,9 @@ packages: engines: {node: '>=8.0.0'} hasBin: true + turbo-stream@3.1.0: + resolution: {integrity: sha512-tVI25WEXl4fckNEmrq70xU1XumxUwEx/FZD5AgEcV8ri7Wvrg2o7GEq8U7htrNx3CajciGm+kDyhRf5JB6t7/A==} + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -11795,19 +11798,21 @@ snapshots: cac: 6.7.14 mime-types: 2.1.35 - '@hiogawa/transforms@0.1.1': + '@hiogawa/transforms@0.1.3': dependencies: estree-walker: 3.0.3 magic-string: 0.30.17 periscopic: 4.0.2 - '@hiogawa/vite-rsc@0.4.2(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0))': + '@hiogawa/vite-rsc@0.4.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0))': dependencies: - '@hiogawa/transforms': 0.1.1 + '@hiogawa/transforms': 0.1.3 '@mjackson/node-fetch-server': 0.6.1 + es-module-lexer: 1.7.0 magic-string: 0.30.17 react: 19.1.0 react-dom: 19.1.0(react@19.1.0) + turbo-stream: 3.1.0 vite: 6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0) vitefu: 1.0.6(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) @@ -19750,6 +19755,8 @@ snapshots: wcwidth: 1.0.1 yargs: 17.7.2 + turbo-stream@3.1.0: {} + type-check@0.4.0: dependencies: prelude-ls: 1.2.1