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
Nondescript compilation error message when Ivy enabled #30885
Comments
Ivy is still experimental and should not be used for production. But you provide the minimum reproduction for checking the issue. |
I had the same error and after some digging and debugging by loggin some additional information in interpreter.ts, the issue was due to using string concatenation inside my routes configuration. For example:
And errors like: |
This is a known issue with the static analysis that the Ivy compiler does. We will need to support such constructions as Additionally, we still have some work to do in producing useful error messages for these cases instead of crashing out. Specifically, the error messages need to show where the static analyzer was unable to understand the code. |
Thank you for the feedback guys. I do use |
I use |
I also tried to remove the object splice operator, but no luck. This is my
|
Same here. I add to replace: |
It works also with { path: `${RoutePathEnum.ERROR_PATH}/:code` } |
Since #33453 went in this should become better, it will become available in the next RC release. I don't know exactly why regular string concatenation wouldn't work, that should be working just fine as far as my testing went. Btw, the error message may still be cryptic even with #33453, as we don't produce a very detailed diagnostic just yet. |
I have the same error "ERROR in Value [object Object] is not literal and cannot be used in this context". |
This error is no longer produced, are you on the latest 9.0 RC release? |
Good morning.
I can confirm that my entire application compiles and runs with Ivy enabled using 9.0.0-rc.9. The issue has been resolved. Thank you all. I am in awe that our project - which is not small by any means - compiles and runs seamlessly in Ivy now. The implementation of Ivy must have been a huge undertaking for you. You are all absolute legends. |
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
When compiling an upgraded Angular 8.0.0 project with Ivy enabled, the compiler generates an
ERROR in Value [object Object] is not literal and cannot be used in this context.
error with no further information to help identify the cause.Is this a regression?
No. I have not tried to compile with Ivy enabled before. The project does compile fine with AoT without Ivy enabled though.
Description
I have a reasonably large application that was recently upgraded from Angular 7 to Angular 8.0.0. The application compiles without issue however when Ivy is enabled the compiler produces the following error:
I reviewed the referenced log files and they provide no additional information.
The only error information that is produced is:
ERROR in Value [object Object] is not literal and cannot be used in this context.
Not sure if relevant, but the normal AoT non-ivy enabled compilation creates 28 separate chunks, with scripts being one of the last chunks created. In the above, it creates only 5 chunks.
馃敩 Minimal Reproduction
I tried compiling an empty Angular 8 project and this compiles with Ivy enabled without issue.
It is very hard to provide a minimum project as my project is quite large and without any additional error information it would take me weeks to gradually remove code until the error goes away.
Although the project does comprise a dozen or so modules, the number of 3rd party NPM packages is quite small and I receive no NPM compatibility warnings when I run
npm clean-install
.Below is a list of installed project NPM packages if this helps:
馃敟 Exception or Error
馃實 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: