@@ -105,6 +105,10 @@ class RscPluginManager {
105105 this . clientReferenceMetaMap = sortObject ( this . clientReferenceMetaMap )
106106 this . serverResourcesMetaMap = sortObject ( this . serverResourcesMetaMap )
107107 }
108+
109+ toRelativeId ( id : string ) : string {
110+ return normalizePath ( path . relative ( this . config . root , id ) )
111+ }
108112}
109113
110114export type RscPluginOptions = {
@@ -1081,9 +1085,7 @@ function vitePluginUseClient(
10811085 referenceKey = importId
10821086 } else {
10831087 importId = id
1084- referenceKey = hashString (
1085- normalizePath ( path . relative ( manager . config . root , id ) ) ,
1086- )
1088+ referenceKey = hashString ( manager . toRelativeId ( id ) )
10871089 }
10881090 }
10891091
@@ -1156,7 +1158,7 @@ function vitePluginUseClient(
11561158 serverChunk : meta . serverChunk ! ,
11571159 } ) ??
11581160 // use original module id as name by default
1159- normalizePath ( path . relative ( manager . config . root , meta . importId ) )
1161+ manager . toRelativeId ( meta . importId )
11601162 name = name . replaceAll ( '..' , '__' )
11611163 const group = ( manager . clientReferenceGroups [ name ] ??= [ ] )
11621164 group . push ( meta )
@@ -1269,11 +1271,8 @@ function vitePluginUseClient(
12691271 meta . renderedExports = mod . renderedExports
12701272 meta . serverChunk =
12711273 ( chunk . facadeModuleId ? 'facade:' : 'non-facade:' ) +
1272- normalizePath (
1273- path . relative (
1274- manager . config . root ,
1275- chunk . facadeModuleId ?? [ ...chunk . moduleIds ] . sort ( ) [ 0 ] ! ,
1276- ) ,
1274+ manager . toRelativeId (
1275+ chunk . facadeModuleId ?? [ ...chunk . moduleIds ] . sort ( ) [ 0 ] ! ,
12771276 )
12781277 }
12791278 }
@@ -1485,7 +1484,7 @@ function vitePluginUseServer(
14851484 id = cleanUrl ( id )
14861485 }
14871486 if ( manager . config . command === 'build' ) {
1488- normalizedId_ = hashString ( path . relative ( manager . config . root , id ) )
1487+ normalizedId_ = hashString ( manager . toRelativeId ( id ) )
14891488 } else {
14901489 normalizedId_ = normalizeViteImportAnalysisUrl (
14911490 manager . server . environments [ serverEnvironmentName ] ! ,
@@ -1994,9 +1993,7 @@ function vitePluginRscCss(
19941993 manager ,
19951994 )
19961995 } else {
1997- const key = normalizePath (
1998- path . relative ( manager . config . root , importer ) ,
1999- )
1996+ const key = manager . toRelativeId ( importer )
20001997 manager . serverResourcesMetaMap [ importer ] = { key }
20011998 return `
20021999 import __vite_rsc_assets_manifest__ from "virtual:vite-rsc/assets-manifest";
0 commit comments