-
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
platform-server errors with ivy-ngcc - UMD module - Angular 9.0.0-rc.7 #34544
Comments
@petebacondarwin @kara I am not sure but I believe it is similar to #31069 |
@naveedahmed1, I cannot reproduce the issue. Here is what I tried: # Attempt 1
npm install --global @angular/cli@9.0.0-rc.7
ng new test-app --defaults
cd test-app
ng add @nguniversal/express-engine --client-project test-app
ng run test-app:server:production
# Attempt 2
rm -rf node_modules
npm install
# Copied your config from https://github.com/angular/angular/issues/34544#issue-541795169 into `angular.json`
ng run test-app:server:production
# Attempt 3
./node_modules/.bin/ngcc In all cases above, the commands completed successfully and in the last one Can you, please, provide a minimal reproduction (e.g. a project we can check out and run) with specific instructions on how to reproduce the problem? |
@gkalpak I have added you to a private repo and dropped you an email. |
Thx, @naveedahmed1. I took a look and there are actually two issues involved:
Having 100% static evaluation for the UMD format is probably out of scope for
|
Thank you so much @gkalpak for sharing the details. Let me also share that it works fine with |
BTW, we already ignore built-in modules: https://github.com/angular/angular/blob/master/packages/compiler-cli/ngcc/src/dependencies/dependency_resolver.ts#L149 |
Can confirm also experiencing this issue only from Angular 9.0.0-rc.7, did not exist in Angular 9.0.0-rc.6 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm still having this issue with latest |
Issue not solved with |
Previously, while trying to build an `NgccReflectionHost`'s `privateDtsDeclarationMap`, `computePrivateDtsDeclarationMap()` would try to collect exported declarations from all source files of the program (i.e. without checking whether they were within the target entry-point, as happens for declarations in `.d.ts` files). Most of the time, that would not be a problem, because external packages would be represented as `.d.ts` files in the program. But when an external package had no typings, the JS files would be used instead. As a result, the `ReflectionHost` would try to (unnecessarilly) parse the file to extract exported declarations, which again would be harmless in most cases. There are certain cases, though, where the `ReflectionHost` would throw an error, because it could not parse the external package's JS file. This could happen, for example, in `UmdReflectionHost`, which expects the file to contain exactly one statement. See angular#34544 for more details on a real-world failure. This commit fixes the issue by ensuring that `computePrivateDtsDeclarationMap()` will only collect declarations from files within the target entry-point. Jira issue: [FW-1794](https://angular-team.atlassian.net/browse/FW-1794) Fixes angular#34544
Previously, while trying to build an `NgccReflectionHost`'s `privateDtsDeclarationMap`, `computePrivateDtsDeclarationMap()` would try to collect exported declarations from all source files of the program (i.e. without checking whether they were within the target entry-point, as happens for declarations in `.d.ts` files). Most of the time, that would not be a problem, because external packages would be represented as `.d.ts` files in the program. But when an external package had no typings, the JS files would be used instead. As a result, the `ReflectionHost` would try to (unnecessarilly) parse the file in order to extract exported declarations, which in turn would be harmless in most cases. There are certain cases, though, where the `ReflectionHost` would throw an error, because it cannot parse the external package's JS file. This could happen, for example, in `UmdReflectionHost`, which expects the file to contain exactly one statement. See angular#34544 for more details on a real-world failure. This commit fixes the issue by ensuring that `computePrivateDtsDeclarationMap()` will only collect exported declarations from files within the target entry-point. Jira issue: [FW-1794](https://angular-team.atlassian.net/browse/FW-1794) Fixes angular#34544
@naveedahmed1, @kainiedziela (or anyone else having the same issue): Could you try with the build artifacts from #34811 and see if the problem is fixed for you? |
@gkalpak sure I can try that can you please guide how to use it? BTW I also added you to a private repository, if you could please use that to test it? Use |
You can find instructions on how to use them here. Basically, you just replace the versions in your package.json to point to the artifacts URL.
I have done that already and the error goes away. But I want to verify that everything still works as expected at runtime and I am not sure how to do that for your app. |
@gkalpak I tried it and its throwing below error: An unhandled exception occurred: compiler_1.Version is not a constructor I am using below packages:
|
This is your problem @naveedahmed1 :
Notice that the URL refers to |
Thank you so much @petebacondarwin :)
@gkalpak yes the backend is in .Net and that's a separate repo. I tested it on my side and I can confirm that the issue has been resolved on runtime as well. Thank you so much for the quick fix :) Looking forward to have it in next release. |
Previously, while trying to build an `NgccReflectionHost`'s `privateDtsDeclarationMap`, `computePrivateDtsDeclarationMap()` would try to collect exported declarations from all source files of the program (i.e. without checking whether they were within the target package, as happens for declarations in `.d.ts` files). Most of the time, that would not be a problem, because external packages would be represented as `.d.ts` files in the program. But when an external package had no typings, the JS files would be used instead. As a result, the `ReflectionHost` would try to (unnecessarilly) parse the file in order to extract exported declarations, which in turn would be harmless in most cases. There are certain cases, though, where the `ReflectionHost` would throw an error, because it cannot parse the external package's JS file. This could happen, for example, in `UmdReflectionHost`, which expects the file to contain exactly one statement. See angular#34544 for more details on a real-world failure. This commit fixes the issue by ensuring that `computePrivateDtsDeclarationMap()` will only collect exported declarations from files within the target package. Jira issue: [FW-1794](https://angular-team.atlassian.net/browse/FW-1794) Fixes angular#34544
@Gbuomprisco it was working fine with Angular 9.0.0-rc.6 and earlier. Hopefully @gkalpak's recent commit (gkalpak@8e53a2b) will fix this in next release. |
Does anyone know if this commit made it into RC10? It's a bit painful having to use the build artifacts. |
No, the fix hasn't landed yet. This is the PR (which is still open): #34811 |
…#34811) Previously, while trying to build an `NgccReflectionHost`'s `privateDtsDeclarationMap`, `computePrivateDtsDeclarationMap()` would try to collect exported declarations from all source files of the program (i.e. without checking whether they were within the target package, as happens for declarations in `.d.ts` files). Most of the time, that would not be a problem, because external packages would be represented as `.d.ts` files in the program. But when an external package had no typings, the JS files would be used instead. As a result, the `ReflectionHost` would try to (unnecessarilly) parse the file in order to extract exported declarations, which in turn would be harmless in most cases. There are certain cases, though, where the `ReflectionHost` would throw an error, because it cannot parse the external package's JS file. This could happen, for example, in `UmdReflectionHost`, which expects the file to contain exactly one statement. See #34544 for more details on a real-world failure. This commit fixes the issue by ensuring that `computePrivateDtsDeclarationMap()` will only collect exported declarations from files within the target package. Jira issue: [FW-1794](https://angular-team.atlassian.net/browse/FW-1794) Fixes #34544 PR Close #34811
@AndrewKushnir can you please confirm if its fixed in RC 11? |
Yes, the fix is included in v9.0.0-rc.11. |
Thank you so much @gkalpak for the confirmation :) |
…angular#34811) Previously, while trying to build an `NgccReflectionHost`'s `privateDtsDeclarationMap`, `computePrivateDtsDeclarationMap()` would try to collect exported declarations from all source files of the program (i.e. without checking whether they were within the target package, as happens for declarations in `.d.ts` files). Most of the time, that would not be a problem, because external packages would be represented as `.d.ts` files in the program. But when an external package had no typings, the JS files would be used instead. As a result, the `ReflectionHost` would try to (unnecessarilly) parse the file in order to extract exported declarations, which in turn would be harmless in most cases. There are certain cases, though, where the `ReflectionHost` would throw an error, because it cannot parse the external package's JS file. This could happen, for example, in `UmdReflectionHost`, which expects the file to contain exactly one statement. See angular#34544 for more details on a real-world failure. This commit fixes the issue by ensuring that `computePrivateDtsDeclarationMap()` will only collect exported declarations from files within the target package. Jira issue: [FW-1794](https://angular-team.atlassian.net/browse/FW-1794) Fixes angular#34544 PR Close angular#34811
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. |
🐞 bug report
Affected Package
The issue is caused by package @angular/platform-server
Is this a regression?
Yes, the previous version in which this bug was not present was: @angular/platform-server@9.0.0-rc.6
Description
When trying to compile my application with Ivy, I get errors on ivy ngcc for platform-server when compiling for umd bundles (for SSR)
🔬 Minimal Reproduction
Update any project to latest version of Angular (9.0.0-rc.7).
Add following config to
angular.json
:Then run command:
ng run MyProject:server:production
🔥 Exception or Error
🌍 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: