Angular CLI – Build Application in Production mode
If you are searching for the way to build an Angular application in production mode, this post is for you.
To do this, you simply run the following command in your application’s root directory:
- angular/cli v6+
ng build --configuration=production
If you have installed angular/cli v6+, you will need to specify production
value to --configuration
option.
- angular/cli v1.x
ng build --env=prod
If you have installed angular/cli v1.x, you will need to specify prod
value to --env
option.
Once the build process is finished, you will get compiled source code in the dist
directory.
> ng build –env=prod –base-href=/
Unknown option: ‘–env’
Thank you for your comment.
We have just updated the post by adding ng build –configuration=production command for angular/cli v6+.