File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
examples/basic/src/framework Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,18 @@ ssrModule.renderHTML(...);
245245export function renderHTML (... ) {}
246246```
247247
248+ #### ` import.meta.viteRsc.import(..., { environment: ... }) `
249+
250+ TODO
251+
252+ ``` ts
253+ const ssrModule = await import .meta .viteRsc .import (
254+ " ./entry.ssr.tsx" ,
255+ { with: { environment: " ssr" } }
256+ )
257+ ssrModule .renderHTML (... );
258+ ```
259+
248260### Available on ` rsc ` environment
249261
250262#### ` import.meta.viteRsc.loadCss `
Original file line number Diff line number Diff line change @@ -91,6 +91,16 @@ async function handleRequest({
9191 } )
9292 }
9393
94+ // TODO: implement this
95+ import . meta. viteRsc . import < typeof import ( './entry.ssr.tsx' ) > ( './entry.ssr' , {
96+ environment : 'ssr' ,
97+ } )
98+ // import.meta.viteRsc.importEnvironment(import("./entry.ssr.tsx"));
99+ // import.meta.viteRsc.importAsset(import("./entry.browser.tsx"));
100+ // import(String("test"), { with: { viteRsc: "environment:ssr" } });
101+ // import(String("test"), { with: { viteRsc: "asset:client" } });
102+ // import("./entry.ssr.tsx", { with: { viteRscEnvironment: "rsc" } });
103+
94104 // Delegate to SSR environment for html rendering.
95105 // The plugin provides `loadModule` helper to allow loading SSR environment entry module
96106 // in RSC environment. however this can be customized by implementing own runtime communication
Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ declare global {
44 loadCss : ( importer ?: string ) => import ( 'react' ) . ReactNode
55 loadModule : < T > ( environmentName : string , entryName ?: string ) => Promise < T >
66 loadBootstrapScriptContent : ( entryName : string ) => Promise < string >
7+
8+ // TODO: loadModule alternative
9+ import : < T > ( specifier , attributes : { environment : string } ) => Promise < T >
10+
11+ // TODO: loadBootstrapScriptContent alternative?
12+ // import: (specifier, attributes: { asset: string }) => Promise<string>
713 }
814 }
915
You can’t perform that action at this time.
0 commit comments