Command
build
Description
We migrated to newer Angular version (@angular/cli@21.0.4), and we got a lot of build errors with prerender: true.
The errors at least for route prerendering are currently very hard to pinpoint, because the error can happen in any component/module/etc that the route uses and there's no error stack.
The errors look like this:
✘ [ERROR] An error occurred while prerendering route '/en/trait-db/browse'.
Cannot read properties of undefined (reading 'trait-search-ignore')
The errors are generated here:
https://github.com/angular/angular-cli/blob/main/packages/angular/build/src/utils/server-rendering/prerender.ts#L263
This line swallows the error stack, because there's an error message almost always present and the newly created error doesn't include the original stack.
I tried adding console.log(error) above that line, and then I could see the error stack.
Error stacks are crucial. Could error management improved during building?
Describe the solution you'd like
Log error stack during build with prerender
Describe alternatives you've considered
No response
Command
build
Description
We migrated to newer Angular version (
@angular/cli@21.0.4), and we got a lot of build errors withprerender: true.The errors at least for route prerendering are currently very hard to pinpoint, because the error can happen in any component/module/etc that the route uses and there's no error stack.
The errors look like this:
The errors are generated here:
https://github.com/angular/angular-cli/blob/main/packages/angular/build/src/utils/server-rendering/prerender.ts#L263
This line swallows the error stack, because there's an error message almost always present and the newly created error doesn't include the original stack.
I tried adding
console.log(error)above that line, and then I could see the error stack.Error stacks are crucial. Could error management improved during building?
Describe the solution you'd like
Log error stack during build with prerender
Describe alternatives you've considered
No response