缓存Travis CI中的Angular模块编译



每次在Travis中运行Angular构建时,都必须将所有Angular模块编译到ESM5

Compiling @angular/core : module as esm5
Compiling @angular/common : module as esm5
etc.

我想知道是否有一种方法可以使用Travi CI的缓存来缓存这些编译后的模块。

在angular ivy中,我们需要编译库以使它们兼容。

这是由ngccutil完成的。如果angular cli找到尚未通过ngcc运行的库,它将立即执行。

你可以通过运行告诉ngcc这样做

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

ngcc的输出存储在node_modules中,因此只要缓存node_modules并在CI中运行时调用以上内容,就可以了。

我建议将其添加为安装后挂钩

package.json文件中添加

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

最新更新