berhir / AspNetCore.SpaYarp

An alternative approach to the new ASP.NET Core SPA templates in .NET 6. It uses YARP as proxy to forward requests to the SPA dev server.
MIT License
99 stars 12 forks source link

[Feature Request] Start the launch Command in a separate process #8

Open mdowais opened 2 years ago

mdowais commented 2 years ago

Hello, The application is executing the Launch Command (Process.Start), if it was not started seperately. But it also closes the process when the Debugging stops/restarts. As stated in the line below

https://github.com/berhir/AspNetCore.SpaYarp/blob/ad4656f5886175ef3ca76646731884cda66c27ec/src/AspNetCore.SpaYarp/SpaProxyLaunchManager.cs#L158

But, it would make it more better if, it stayed even after stopping, which would be a great improvement when dealing with large SPA application.

The Stopping process is called using powershell, and I guess it could be started using the same way, which would keep it alive even when stopped debugging

I suggest to create a property in SpaDevelopmentServerOptions, which allows a functionality like LaunchDevServerIndependently, which wont close when debugger is stopped / restarted.

It makes it easy, so that the developer doesnt have to start the devserver manually/independently.

BenjaminVettori commented 1 year ago

@mdowais to achieve what you want, you can launch the development server using npm start manually first and then (once your angular client is up and running, listening to your configured port) start your c# backend. It should automatically recognize the already running client live-server and skip starting a new one.