Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safe to remove ngcc from postinstall script?

Tags:

angular

Angular CLI: 11.0.3
Angular: 11.0.9
Node:14.20.1
Ivy Workspace: Yes

I have a legacy application building with the above context. It runs a postinstall script of ngcc from the packages.json.

My understanding was that this was to make pre-Ivy libraries build in an Ivy compliant way. Given that post Angular 9 everything is built for Ivy by default, is it safe to remove this postinstall step?

like image 225
Fred2020 Avatar asked Jul 13 '26 08:07

Fred2020


1 Answers

Yes, your understanding is correct. The Angular Compatibility Compiler (ngcc) was introduced in Angular 9 to compile packages that were not yet Ivy-ready into an Ivy-compatible format. Since Angular 9, all new packages are published in the Ivy instruction set by default, so they don't require this step.

However, the question of whether it's safe to remove this postinstall step depends on the specific packages that your application is using. If your application depends on packages that were last updated before Angular 9 (and hence, are not Ivy-ready), then you still need ngcc to make them compatible.

If all of your dependencies are updated and are Ivy-ready, then you can safely remove the ngcc postinstall step.

It would be advisable to check all your dependencies before making this change. You can do this by looking at the package details on npmjs.com or the package's GitHub repository. If you find any that were last updated before Angular 9, you'll need to either update them to a more recent version or continue using ngcc.

Remember, always test thoroughly after making changes like this to ensure nothing has broken as a result.

like image 157
Alberto Hernández Angel Avatar answered Jul 15 '26 23:07

Alberto Hernández Angel