简体   繁体   中英

Reduce startup time when debugging Angular in Visual Studio 2019

I just used the Angular+ASP.NET Core template for a new application, run it in debug mode, stopped it, made no change, re-run it in debug mode and so on.

Startup time is excruciatingly long even with no change whatsoever in between subsequent runs.

I read some time ago that you could keep ng running or something like that to reduce startup time, but I can't find what that is. Is it correct? If so, how to do it?

It takes long because each time you run the application, it starts an instance of Angular dev server in the background and rebuilds your client app.

In the Configure method of Startup class replace

spa.UseAngularCliServer(npmScript: "start");

with

spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");

This will prevent running the Angular dev server automatically.

Now run the dev server manually with npm start and then run your application.

Further detail - Run "ng serve" independently

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM