File tree Expand file tree Collapse file tree 5 files changed +10
-30
lines changed Expand file tree Collapse file tree 5 files changed +10
-30
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
44// https://vitejs.dev/config/ 
55export  default  defineConfig ( { 
66  plugins : [ react ( ) ] , 
7+   server : { 
8+     port : parseInt ( process . env . PORT  ??  '5173' ) 
9+   } 
710} ) 
Original file line number Diff line number Diff line change @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
44// https://vitejs.dev/config/ 
55export  default  defineConfig ( { 
66  plugins : [ react ( ) ] , 
7+   server : { 
8+     port : parseInt ( process . env . PORT  ??  '5173' ) 
9+   } 
710} ) 
Original file line number Diff line number Diff line change @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
44// https://vitejs.dev/config/ 
55export  default  defineConfig ( { 
66  plugins : [ react ( ) ] , 
7+   server : { 
8+     port : parseInt ( process . env . PORT  ??  '5173' ) 
9+   } 
710} ) 
Original file line number Diff line number Diff line change @@ -37,34 +37,9 @@ public static IResourceBuilder<NodeAppResource> AddViteApp(this IDistributedAppl
3737            _ =>  builder . AddNpmApp ( name ,  wd ,  "dev" ) 
3838        } ; 
3939
40-         var   endpointBuilder   =  useHttps 
40+         return  useHttps 
4141            ?  resource . WithHttpsEndpoint ( env :  "PORT" ) . WithExternalHttpEndpoints ( ) 
4242            :  resource . WithHttpEndpoint ( env :  "PORT" ) . WithExternalHttpEndpoints ( ) ; 
43- 
44-         builder . Eventing . Subscribe < ResourceEndpointsAllocatedEvent > ( ( @event ,  ct )  => 
45-         { 
46-             if  ( @event . Resource . Name  !=  name ) 
47-             { 
48-                 return  Task . CompletedTask ; 
49-             } 
50- 
51-             endpointBuilder . WithArgs ( ctx => 
52-             { 
53-                 if  ( @event . Resource . TryGetEndpoints ( out  var  endpoints ) ) 
54-                 { 
55-                     // Set the PORT environment variable to the first endpoint's port 
56-                     var  firstEndpoint  =  endpoints . FirstOrDefault ( ) ; 
57- 
58-                     ctx . Args . Add ( "--" ) ; 
59-                     ctx . Args . Add ( "--port" ) ; 
60-                     ctx . Args . Add ( firstEndpoint ? . AllocatedEndpoint ? . Port . ToString ( )  ??  "5173" ) ; 
61-                 } 
62-             } ) ; 
63- 
64-             return  Task . CompletedTask ; 
65-         } ) ; 
66- 
67-         return  resource ; 
6843    } 
6944
7045    /// <summary> 
Original file line number Diff line number Diff line change @@ -217,9 +217,5 @@ public void ViteAppConfiguresPortFromEnvironment()
217217        var  httpEndpoint  =  endpoints . FirstOrDefault ( e =>  e . UriScheme  ==  "http" ) ; 
218218        Assert . NotNull ( httpEndpoint ) ; 
219219        Assert . Equal ( "PORT" ,  httpEndpoint . EnvVar ) ; 
220- 
221-         // Verify that command line arguments callback is configured 
222-         Assert . True ( resource . TryGetAnnotationsOfType < CommandLineArgsCallbackAnnotation > ( out  var  argsCallbacks ) ) ; 
223-         Assert . NotEmpty ( argsCallbacks ) ; 
224220    } 
225221} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments