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:
- Open
angular.json
and change the configuration of the production build:
- Set
outputHashing
to none
- Set
sourceMap
to true
- Set
vendorChunk
to true
- Run
ng build --prod
to build in production mode.