Encountering issues building the production version of my Angular app.
The IDE console only displays this message:
ERROR in Cannot assign to a reference or variable!
To successfully build, I need to include these options:
--aot=false --buildOptimizer=false
However, even with these options, the app fails after deployment with this error message in the browser console:
ERROR TypeError: Cannot read property 'init' of undefined
This issue can be resolved by adding another option:
--optimization=false
When attempting to build using:
npm run ng build -- --prod
A log file provides some information:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Backend\\nodejs\\node.exe', ...
Despite updating everything, the problem persists. The output of ng version
is as follows:
Angular CLI: 8.3.4
Node: 10.15.3
OS: win32 x64
Angular: 8.2.6
...
Having examined the source code available at the link provided, I am seeking guidance on how to identify and resolve this error.
Similar query posted on ru.stackoverflow
:
SOLVED:
The root cause of the error has been identified (credit to SO user ): an attempt was made to alter the value of a variable defined within a template using a custom directive.
The lack of clear error messaging complicated troubleshooting, necessitating debugging via the compiler. For more details, refer to this discussion (in Russian):
UPDATE:
Issues and PRs have been submitted to the Angular repository for resolution: