ng build is the command you use when you're ready to build your application and deploy it. The CLI will analyze the application and build the files, all while optimizing the application as best as it can. It will then output the files in the
dist/your-project-name folder, ready to be placed on a server and ready to be visited.
We talked about two flags to use with this command:
- --configuration: This flag sets the build configuration to use for your application. The value must be present in the
angular.jsonfile, in the
- --prod: This flag is shorthand for --configuration=production. This is the desired command to run when building your application for a production environment
There are more flags you can use with the command, but these are the ones I've used most frequently. Most of the other flags are already set by options in the
angular.json file. However, if you'd like to look at those flags, you can see more about them in the documentation.