Repository navigation
fix(@angular/build): fail build and exclude routes when prerendering fails - #33971
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the prerendering process to ensure that only successfully prerendered routes are included in the final output. It updates prerenderPages to track and return successfully generated routes, refactors RenderResultItem into a discriminated union to distinguish between successful renders and errors, and adds an E2E test to verify this behavior. Feedback on the changes includes addressing a bug in the new E2E test where a try-catch block silently swallows assertion failures, and a recommendation to extract duplicated route-to-output-path resolution logic into a shared helper function.
7ce0519 to
c5021a0
Compare
…fails
When a prerendered route failed to render (such as when a component throws
during route activation), the render worker returned null content which was
silently skipped. Consequently, no HTML file was written, but the build still
reported the route in prerender statistics, included it in prerendered-routes.json,
and exited with code 0.
Now:
- The render worker throws an error if content is null ('The content returned was empty.').
- Prerendering records the error so the build fails with a non-zero exit code.
- Prerendered routes recorded for manifest and statistics are derived strictly from routes that produced output files.
Closes angular#33965
c5021a0 to
1dadd3d
Compare
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When a prerendered route fails to render (such as when a component throws during route activation), the render worker returned null content which was silently ignored. Consequently, no HTML file was written to disk, but the build still reported the route in prerender statistics, included it in
prerendered-routes.json, and exited with code 0.Now:
'The content returned was empty.').Closes #33965