File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -963,20 +963,6 @@ function hashString(v: string) {
963963  return  createHash ( 'sha256' ) . update ( v ) . digest ( ) . toString ( 'hex' ) . slice ( 0 ,  12 ) 
964964} 
965965
966- function  normalizeReferenceId ( 
967-   id : string , 
968-   name : 'client'  |  'rsc'  |  ( string  &  { } ) , 
969- )  { 
970-   if  ( ! server )  { 
971-     return  hashString ( path . relative ( config . root ,  id ) ) 
972-   } 
973- 
974-   // align with how Vite import analysis would rewrite id 
975-   // to avoid double modules on browser and ssr. 
976-   const  environment  =  server . environments [ name ] ! 
977-   return  normalizeViteImportAnalysisUrl ( environment ,  id ) 
978- } 
979- 
980966/** @experimental  */ 
981967export  function  vitePluginUseClient ( 
982968  useClientPluginOptions : Pick < 
@@ -1289,7 +1275,14 @@ export function vitePluginUseServer(
12891275              // module identity of `import(id)` like browser, so we simply strip it off. 
12901276              id  =  id . split ( '?v=' ) [ 0 ] ! 
12911277            } 
1292-             normalizedId_  =  normalizeReferenceId ( id ,  serverEnvironmentName ) 
1278+             if  ( config . command  ===  'build' )  { 
1279+               normalizedId_  =  hashString ( path . relative ( config . root ,  id ) ) 
1280+             }  else  { 
1281+               normalizedId_  =  normalizeViteImportAnalysisUrl ( 
1282+                 server . environments [ serverEnvironmentName ] ! , 
1283+                 id , 
1284+               ) 
1285+             } 
12931286          } 
12941287          return  normalizedId_ 
12951288        } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments