File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -938,17 +938,6 @@ function hashString(v: string) {
938938 return createHash ( 'sha256' ) . update ( v ) . digest ( ) . toString ( 'hex' ) . slice ( 0 , 12 )
939939}
940940
941- function normalizeReferenceId ( id : string , name : 'client' | 'rsc' ) {
942- if ( ! server ) {
943- return hashString ( path . relative ( config . root , id ) )
944- }
945-
946- // align with how Vite import analysis would rewrite id
947- // to avoid double modules on browser and ssr.
948- const environment = server . environments [ name ] !
949- return normalizeViteImportAnalysisUrl ( environment , id )
950- }
951-
952941function vitePluginUseClient (
953942 useClientPluginOptions : Pick <
954943 RscPluginOptions ,
@@ -1243,7 +1232,14 @@ function vitePluginUseServer(
12431232 // module identity of `import(id)` like browser, so we simply strip it off.
12441233 id = id . split ( '?v=' ) [ 0 ] !
12451234 }
1246- normalizedId_ = normalizeReferenceId ( id , 'rsc' )
1235+ if ( config . command === 'build' ) {
1236+ normalizedId_ = hashString ( path . relative ( config . root , id ) )
1237+ } else {
1238+ normalizedId_ = normalizeViteImportAnalysisUrl (
1239+ server . environments . rsc ! ,
1240+ id ,
1241+ )
1242+ }
12471243 }
12481244 return normalizedId_
12491245 }
You can’t perform that action at this time.
0 commit comments