Skip to content

Commit 70b20a1

Browse files
committed
feat(rsc): enable server-chunk-based client chunks
1 parent f335343 commit 70b20a1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/plugin-rsc/src/plugin.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ export type RscPluginOptions = {
196196
clientChunks?: (meta: {
197197
/** client reference module id */
198198
id: string
199+
/** normalized client reference module id */
200+
relativeId: string
199201
/** server chunk which includes a corresponding client reference proxy module */
200202
serverChunk: string
201203
}) => string | undefined
@@ -1190,10 +1192,9 @@ function vitePluginUseClient(
11901192
let name =
11911193
useClientPluginOptions.clientChunks?.({
11921194
id: meta.importId,
1195+
relativeId: manager.toRelativeId(meta.importId),
11931196
serverChunk: meta.serverChunk!,
1194-
}) ??
1195-
// use original module id as name by default
1196-
manager.toRelativeId(meta.importId)
1197+
}) ?? meta.serverChunk!
11971198
// ensure clean virtual id to avoid interfering with other plugins
11981199
name = cleanUrl(name.replaceAll('..', '__'))
11991200
const group = (manager.clientReferenceGroups[name] ??= [])

0 commit comments

Comments
 (0)