Sébastien
Sébastien

Reputation: 1697

How to automatically set Angular in production mode when running ASP.NET Core in release mode

I used the build in template to run Angular in an ASP.NET Core MVC app. I wonder how I could set the environment.production variable of Angular to true when running the ASP app in release mode (while using false in debug). This way, I don't have to manually add or remove enableProdMode().

Upvotes: 1

Views: 1527

Answers (1)

Nathan Gavenski
Nathan Gavenski

Reputation: 263

There is this HUGE article on Angular website that talks about deployment. I do recommend reading it (https://angular.io/guide/deployment)

But a TL:DR would be that you can run

ng build --prod --build-optimizer

For a production code and ng build or ng serve for a debug / development environment

Upvotes: 1

Related Questions