Slow incremental rebuild

🚀 Feature request

Option to turn off tree shaking (which is suppose to be slow).

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

I have quite big angular@11 project. App folder has 4MB within 2100 files. I know it is big. Initial compilation takes over 130 seconds. My command is node --max_old_space_size=10000 ./node_modules/@angular/cli/bin/ng serve so I’m giving node extra memory.

Problem is with recompilation. I’ve made an isolated lazy loaded module:

{
    path: 'dev',
    loadChildren: () => import('@dev/dev-pages/dev-pages.module').then(m => m.DevPagesModule)
  },

In that module I have only one, auto generated page component:

<p>page-dev-test works!</p>

If I add any string to template it takes almost 20 seconds to recompile (file is only 7kB) :/ Is it normal? Can I speed this up?

ng

Describe the solution you’d like

One of stackoverflowers (https://stackoverflow.com/a/65882673/979911) suggested that tree shaking is very have process which takes lot of time. How about turning it off in development?

2 thoughts on “Slow incremental rebuild

  1. With the help of @alan-agius4 I got to a point where the rebuild is only ~3seconds; we needed to set "extractLicenses": false to disable license extraction. We are yet to figure out why that would have been enabled, as it should be disabled by default.