New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
ngcc: do not parse tsconfig.json more than once #36882
Comments
Thanks for creating this issue @mpk - I hope to look into it later this week. |
Is this a duplicate of #36272? |
Not really. There are a number of reasons why the build can be slow at 0%. This is one particular reason. @mpk - I would like to understand why parsing the config file content (i.e. calling |
@petebacondarwin I have created a project that demonstrates the problem: https://github.com/mpk/ng-many-components
|
I cloned this repo... |
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Resolves angular#36882
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Resolves angular#36882
Hopefully #37417 will fix this for you. Once the CI has run, you should be able to try using the output from it, although you might need to update your project to v10 first. |
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Resolves #36882 PR Close #37417
Please can this be added to a v9 release. |
Looking into it... there should still be a 9.1.x release on Wednesday |
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Cherry-picked from angular#37417 (6e7bd93). Resolves angular#36882
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Cherry-picked from angular#37417 (6e7bd93). Resolves angular#36882
9.1.x is not the LTS branch - so I have created a separate PR for it: #37484 |
@petebacondarwin Thank you so much for this. Really appreciate your time and effort looking at this issue |
@petebacondarwin Thank you for the fix, I have verified the 6 minute delay is gone and compilation times have returned to Angular 8 level. |
馃帀 I am really pleased. Thanks for the update. |
Can also confirm that this has fixed the issue for me. Thanks once again. |
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Resolves angular#36882 PR Close angular#37417
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This commit will store a cached copy of the parsed tsconfig that can be reused if the tsconfig path is the same. This will improve the ngcc "noop" case, where there is no processing to do, when the entry-points have already been processed. Previously we were parsing this config every time we checked for entry-points to process, which can take up to seconds in some cases. Resolves angular#36882 PR Close angular#37417
馃悶 bug report
Affected Package
The issue is caused by package @angular/compiler-cli
Is this a regression?
Yes, the previous version in which this bug was not present was: 8.2Description
(this issue was separated from issue #36874 (comment))
After upgrading Angular 8 to Angular 9 (and Ivy), I have a problem with Angular CLI being stuck at "0% compiling" for a few minutes.
In my app, I have 324 npm modules that should be compiled by NGCC. First
ng serve
after npm install takes some time before all of them are compiled and cached, but that's fine. However, subsequent serves are also very slow (~ 9 minutes).I have done some digging and found out that for each npm module (before mainNgcc bails out early due to cache), the following line is run (mainNgcc -> getSharedSetup -> readConfiguration):
https://github.com/angular/angular/blob/master/packages/compiler-cli/src/perform_compile.ts#L197
This line parses and resolves application's tsconfig.json file (by walking through the entire project directory, which in my case is ~ 3700 files) and it takes about 1.1s to do so. However, since it is run for each npm module (in my case 324 modules), this results in 1.1s * 324 modules = 6 minutes delay before the actual application start compiling.
I think the tsconfig.json should be parsed and resolved only once to avoid this delay.
馃敩 Minimal Reproduction
Create Angular 9 application with many npm modules and large project structure.
Run
npm start
.馃實 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: