-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ngcc): report a warning if ngcc tries to use a solution-style tsconfig #38003
fix(ngcc): report a warning if ngcc tries to use a solution-style tsconfig #38003
Conversation
0cd55d6
to
bcbb39f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type in commit message: "a explicit" -> "an explicit"
@@ -112,6 +112,7 @@ export interface ParsedConfiguration { | |||
project: string; | |||
options: api.CompilerOptions; | |||
rootNames: string[]; | |||
projectReferences?: readonly ts.ProjectReference[]|undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't come up with a cleaner way for ngcc to work out whether this tsconfig was solution-style. I didn't want to do the computation here and have a flag (like isSolutionStyleConfig
).
But if ngc
wanted to do something similar there might be value with moving the test from ngcc to here...
…onfig In CLI v10 there was a move to use the new solution-style tsconfig which became available in TS 3.9. The result of this is that the standard tsconfig.json no longer contains important information such as "paths" mappings, which ngcc might need to correctly compute dependencies. ngcc (and ngc and tsc) infer the path to tsconfig.json if not given an explicit tsconfig file-path. But now that means it infers the solution tsconfig rather than one that contains the useful information it used to get. This commit logs a warning in this case to inform the developer that they might not have meant to load this tsconfig and offer alternative options. Fixes angular#36386
bcbb39f
to
98d03ff
Compare
9ba3331
to
6670b17
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…onfig (#38003) In CLI v10 there was a move to use the new solution-style tsconfig which became available in TS 3.9. The result of this is that the standard tsconfig.json no longer contains important information such as "paths" mappings, which ngcc might need to correctly compute dependencies. ngcc (and ngc and tsc) infer the path to tsconfig.json if not given an explicit tsconfig file-path. But now that means it infers the solution tsconfig rather than one that contains the useful information it used to get. This commit logs a warning in this case to inform the developer that they might not have meant to load this tsconfig and offer alternative options. Fixes #36386 PR Close #38003
I think it would be beneficial to update the Angular Ivy guide to explain which tsconfig file to specify. |
@rhysowen9 - how are you running ngcc? What is the content of the warning that you get? It should be listing the paths to the possible tsconfigs that you can choose. It would be normal to run ngcc against the "app" config (possibly |
I believe that It is a Now that we have upgraded to Angular 10, and updated to the latest patch, we are getting the warning introduced by this PR. We've stripped |
Please feel free to remove this postinstall hook, as long as you are using CLI for building your app. |
Could you explain why we can remove that postinstall hook? It is still in the document https://update.angular.io/#9.0:10.0l3 If you depend on many Angular libraries you may consider speeding up your build by invoking the ngcc (Angular Compatibility Compiler) in an npm postinstall script via small change to your package.json. |
I agree with @maxisam. The postinstall script is "recommended" in both the angular documentation and the angular update guides. Can we get clarification? |
Currently our docs do not recommend running ngcc as a postinstall hook, except for a particular scenario related to Angular Universal: https://angular.io/guide/ivy#ivy-and-universalapp-shell. |
@petebacondarwin ah you're right, I misread that page i guess. Thank you for the help! |
No problem. Sorry for the confusion |
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. |
…onfig (angular#38003) In CLI v10 there was a move to use the new solution-style tsconfig which became available in TS 3.9. The result of this is that the standard tsconfig.json no longer contains important information such as "paths" mappings, which ngcc might need to correctly compute dependencies. ngcc (and ngc and tsc) infer the path to tsconfig.json if not given an explicit tsconfig file-path. But now that means it infers the solution tsconfig rather than one that contains the useful information it used to get. This commit logs a warning in this case to inform the developer that they might not have meant to load this tsconfig and offer alternative options. Fixes angular#36386 PR Close angular#38003
In CLI v10 there was a move to use the new solution-style tsconfig
which became available in TS 3.9. The result of this is that the standard
tsconfig.json, which ngcc (and ngc and tsc) infer if not given a explicit
tsconfig file path no longer contains important information such as
"paths" mappings, which ngcc might need to correctly compute
dependencies.
This commit logs a warning in this case to inform the developer
that they might not have meant to load this tsconfig and offer
alternative options.
Fixes #36386