@@ -105,6 +105,10 @@ class RscPluginManager {
105
105
this . clientReferenceMetaMap = sortObject ( this . clientReferenceMetaMap )
106
106
this . serverResourcesMetaMap = sortObject ( this . serverResourcesMetaMap )
107
107
}
108
+
109
+ toRelativeId ( id : string ) : string {
110
+ return normalizePath ( path . relative ( this . config . root , id ) )
111
+ }
108
112
}
109
113
110
114
export type RscPluginOptions = {
@@ -1081,9 +1085,7 @@ function vitePluginUseClient(
1081
1085
referenceKey = importId
1082
1086
} else {
1083
1087
importId = id
1084
- referenceKey = hashString (
1085
- normalizePath ( path . relative ( manager . config . root , id ) ) ,
1086
- )
1088
+ referenceKey = hashString ( manager . toRelativeId ( id ) )
1087
1089
}
1088
1090
}
1089
1091
@@ -1156,7 +1158,7 @@ function vitePluginUseClient(
1156
1158
serverChunk : meta . serverChunk ! ,
1157
1159
} ) ??
1158
1160
// use original module id as name by default
1159
- normalizePath ( path . relative ( manager . config . root , meta . importId ) )
1161
+ manager . toRelativeId ( meta . importId )
1160
1162
name = name . replaceAll ( '..' , '__' )
1161
1163
const group = ( manager . clientReferenceGroups [ name ] ??= [ ] )
1162
1164
group . push ( meta )
@@ -1269,11 +1271,8 @@ function vitePluginUseClient(
1269
1271
meta . renderedExports = mod . renderedExports
1270
1272
meta . serverChunk =
1271
1273
( 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 ] ! ,
1277
1276
)
1278
1277
}
1279
1278
}
@@ -1485,7 +1484,7 @@ function vitePluginUseServer(
1485
1484
id = cleanUrl ( id )
1486
1485
}
1487
1486
if ( manager . config . command === 'build' ) {
1488
- normalizedId_ = hashString ( path . relative ( manager . config . root , id ) )
1487
+ normalizedId_ = hashString ( manager . toRelativeId ( id ) )
1489
1488
} else {
1490
1489
normalizedId_ = normalizeViteImportAnalysisUrl (
1491
1490
manager . server . environments [ serverEnvironmentName ] ! ,
@@ -1994,9 +1993,7 @@ function vitePluginRscCss(
1994
1993
manager ,
1995
1994
)
1996
1995
} else {
1997
- const key = normalizePath (
1998
- path . relative ( manager . config . root , importer ) ,
1999
- )
1996
+ const key = manager . toRelativeId ( importer )
2000
1997
manager . serverResourcesMetaMap [ importer ] = { key }
2001
1998
return `
2002
1999
import __vite_rsc_assets_manifest__ from "virtual:vite-rsc/assets-manifest";
0 commit comments