If you run npm run build or just ng build, Angular builds in development mode. To create a production build, run ng build --prod. Because the build looks a bit different in production mode, we can make some adjustments to the configuration (for example, to ensure the build files are named in the same way as in development build).

Since the default build keeps changing the names of the resulting files, this will be impractical, so we recommend you make these adjustments:

  1. Open angular.json and change the configuration of the production build:
    1. Set outputHashing to none
    2. Set sourceMap to true
    3. Set vendorChunk to true
  2. Run ng build --prod to build in production mode.