Every time when I run my Angular builds in Travis it has to compile all the Angular modules to ESM5
Compiling @angular/core : module as esm5
Compiling @angular/common : module as esm5
etc.
I wondered if there was a way to cache these compiled modules using Travi-CI's cache.
in angular ivy, we need to compile libraries so that they are compatible.
This is done by the ngcc
util.
If angular-cli finds libraries that have not been run through ngcc it will do it on the fly.
You can tell ngcc to do this by running
ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
The output of ngcc is stored within node_modules
so as long as you cache node_modules
and call the above when running in CI you should be fine.
I suggest adding it as a post install hook
in your package.json
file add
{
...
"scripts": {
...
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
}
}