File tree Expand file tree Collapse file tree 3 files changed +16
-26
lines changed
Expand file tree Collapse file tree 3 files changed +16
-26
lines changed Original file line number Diff line number Diff line change 6565 "buildTarget" : " MyApp.Client:build:development"
6666 }
6767 },
68- "defaultConfiguration" : " development" ,
69- "options" : {
70- "proxyConfig" : " src/proxy.conf.js"
71- }
68+ "defaultConfiguration" : " development"
7269 },
7370 "extract-i18n" : {
7471 "builder" : " @angular-devkit/build-angular:extract-i18n"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3838services . AddServiceStack ( typeof ( MyServices ) . Assembly ) ;
3939
4040var app = builder . Build ( ) ;
41- var nodeProxy = new NodeProxy ( "http://127.0.0.1 :4200" ) {
41+ var nodeProxy = new NodeProxy ( "http://localhost :4200" ) {
4242 Log = app . Logger
4343} ;
4444
7272// Proxy development HMR WebSocket and fallback routes to the Next server
7373if ( app . Environment . IsDevelopment ( ) )
7474{
75- // Start the Next.js dev server if the Next.js lockfile does not exist
76- app . RunNodeProcess ( nodeProxy ,
77- lockFile : "../MyApp.Client/dist/lock" ,
78- workingDirectory : "../MyApp.Client" ) ;
79-
75+ // Start the Angular dev server if it's not running
76+ var portAvailable = System . Net . NetworkInformation . IPGlobalProperties . GetIPGlobalProperties ( )
77+ . GetActiveTcpListeners ( ) . All ( x => x . Port != 4200 ) ;
78+ if ( portAvailable && nodeProxy . TryStartNode ( "../MyApp.Client" , out var process ) )
79+ {
80+ app . Lifetime . ApplicationStopping . Register ( ( ) => {
81+ if ( ! process . HasExited )
82+ {
83+ nodeProxy . Log . LogDebug ( "Terminating process: " + process . Id ) ;
84+ process . Kill ( entireProcessTree : true ) ;
85+ }
86+ } ) ;
87+ }
88+
8089 app . UseWebSockets ( ) ;
8190 app . MapViteHmr ( nodeProxy ) ;
8291 app . MapFallbackToNode ( nodeProxy ) ;
You can’t perform that action at this time.
0 commit comments