Angular › Build, Environments & Deployment

How do you create a production build of an Angular app?

Beginner

Answer

Running ng build with the production configuration creates an optimized version of your app, with smaller file sizes and development warnings removed, ready to be uploaded to a real web server for actual visitors to use.
ng build --configuration production
// creates a dist folder containing optimized HTML, CSS, and JavaScript files
// ready to be uploaded to a hosting service
Real-world example A small business finishes testing their new website locally, runs the production build command, and uploads the resulting files to their hosting provider so real customers can visit the live site.

Common follow-ups: Why should you never deploy the development version of an Angular app to real users?;What specific optimizations does the production configuration apply?