Improving production build time for Angular 8 application in Azure Devops

Hey according to the documentation you can optimize you builds with

  • Lazy loading. only loading the application modules that absolutely must be present when the app starts. Configure the Angular Router to defer loading of all other modules (and their associated code)

  • Enabling the --prod mode on your build command, ;) of course. You can then inspect the bundle size using a library called source-map-explorer

    npm install source-map-explorer --save-dev

Build your app for production including the source maps

ng build --prod --source-map

List the generated bundles in the dist/ folder.

ls dist/*.bundle.js

Run the explorer to generate a graphical representation of one of the bundles. The following example displays the graph for the main bundle.

node_modules/.bin/source-map-explorer dist/main.*.bundle.js

You can get more info at the angular docs here