What do I need to cache in my CI job to avoid ngcc recompiling each time?

Solution 1:

UPDATE 1:

Hard coded Ivy entry points have been Removed from the angular build if you are using latest, it was previously & wrongly hardcoded inside Angular init TS github code link

Now/latest you can just do

ngcc --properties es2015 browser module main



For older versions only, please see Update 1 for newer versions

ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points

Or as par of you build inside package.json

{  
  "scripts": {    
    "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
  }
}

Some ref configure Travis to

# custom caching for .travis.yml
install:
- npm ci
# keep the npm cache around to speed up installs
cache:
  directories:
  - "$HOME/.npm"
# you can add other 

Option 2: Much faster with yarn or pnpm

pnpm install
// or
yarn install
// or
npm install --prefer-offline --no-audit