Skip to content

Commit a0d4414

Browse files
committed
fix: try adding .txt extension to built RSC Payload
1 parent 91d05c1 commit a0d4414

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/docs/src/pages/api/Defer.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const routes = [
8585

8686
## How It Works
8787

88-
By default, FUNSTACK Static puts the entire app (`<App />`) into one RSC payload (`/.funstack/index.rsc`). The client fetches this payload to render your SPA.
88+
By default, FUNSTACK Static puts the entire app (`<App />`) into one RSC payload (`/.funstack/index.txt`). The client fetches this payload to render your SPA.
8989

9090
When you use `defer(Component)`, FUNSTACK Static creates **additional RSC payloads** for the rendering result of `<Component />`. This results in an additional emit of RSC payload files like `/.funstack/rsc/fun:rsc-payload/b5698be72eea3c37`.
9191

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/**
22
* Path to RSC payload in build output
33
*/
4-
export const rscPayloadPath = "/.funstack/index.rsc";
4+
export const rscPayloadPath = "/.funstack/index.txt";

packages/static/src/rsc/rscModule.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,23 @@ export function getPayloadIDFor(rawId: string): string {
1212
}
1313

1414
const rscModulePathPrefix = "/.funstack/rsc/";
15+
const rscModulePathSuffix = ".txt";
1516

1617
export function getModulePathFor(id: string): string {
17-
return `${rscModulePathPrefix}${id}`;
18+
return `${rscModulePathPrefix}${id}${rscModulePathSuffix}`;
1819
}
1920

2021
export function extractIDFromModulePath(
2122
modulePath: string,
2223
): string | undefined {
23-
if (!modulePath.startsWith(rscModulePathPrefix)) {
24+
if (
25+
!modulePath.startsWith(rscModulePathPrefix) ||
26+
!modulePath.endsWith(rscModulePathSuffix)
27+
) {
2428
return undefined;
2529
}
26-
return modulePath.slice(rscModulePathPrefix.length);
30+
return modulePath.slice(
31+
rscModulePathPrefix.length,
32+
-rscModulePathSuffix.length,
33+
);
2734
}

0 commit comments

Comments
 (0)