Currently this script is added
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
when adding something from @nrwl/angular.
However I just noticed this
... If you opt-out of bundling dependencies you will need to run the standalone Angular compatibility compiler (ngcc). This is needed because otherwise Node will be unable to resolve the Ivy version of the packages.
You can run ngcc after each installation of node_modules by adding a postinstall npm script:
// package.json
{
"scripts": {
"postinstall": "ngcc"
}
}
Don't use --create-ivy-entry-points as this will cause Node not to resolve the Ivy version of the packages correctly.
So I was wondering if it being there is correct?
@FrozenPandaz @brandonroberts could you reply?
yes interested in this as well, because I keep getting errors like below and I am wondering if it is connected to this.
Error: Error on worker #3: Error: Tried to overwrite <removed>/node_modules/@sitecore-jss/sitecore-jss-angular/dist/components/file.directive.d.ts.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.
Yes, that is still the recommended way as defined in that doc, as we only want to run ngcc when node_modules change.
https://angular.io/guide/ivy#speeding-up-ngcc-compilation
If you have a reproduction of the error, it may need to be filed in the https://github.com/angular/angular repo to be fixed in ngcc upstream, or even by the third-party library.
It seems if I run production build in parallel, I do need to have
// package.json
{
"scripts": {
"postinstall": "ngcc"
}
}
instead of
// package.json
{
"scripts": {
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"
}
}
otherwise my build will fail as reported here: https://github.com/nrwl/nx/issues/2108
@brandonroberts I am having trouble understanding, so you are saying that running "postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points" is still permissible? or are you saying we should follow the docs and not run with the --create-ivy-entry-points flag? Thanks very much!
@brandonroberts I'm confused.
It sounds like you are saying to follow the document and remove the --create-ivy-entry-points flag. Do we also then remove all the other elements other than the ngcc, i.e.,:
// package.json
{
"scripts": {
"postinstall": "ngcc"
}
}
It looks like there is also a node ./decorate-angular-cli.js element that was added by the 9-0-0 migration.
Would it be possible to add documentation or a new migration in Angular 10 (or 11) that brings the postinstall script to where you want it to be for Nx support on top of the CLI now that we're in Angular 10 and Ivy is standard/default?
Hi Guys is not clear to me after read all thread if I need to continue using
ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
or just:
ngcc
I'm came here after reading the following:
_Don't use --create-ivy-entry-points as this will cause Node not to resolve the Ivy version of the packages correctly._
from the angular documentation https://angular.io/guide/ivy
but is not clear to me what I need to do in the latest angular version (11.0.4)
Please can anyone clarify?
Thanks!
Most helpful comment
@brandonroberts I am having trouble understanding, so you are saying that running
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points"is still permissible? or are you saying we should follow the docs and not run with the--create-ivy-entry-pointsflag? Thanks very much!