fix(@angular/build): fail build and exclude routes when prerendering fails - #33971
Merged
alan-agius4 merged 1 commit intoAug 31, 2026
Merged
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.
alan-agius4
force-pushed
the
fix-prerender-failure-reporting
branch
from
August 31, 2026 08:22
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
alan-agius4
force-pushed
the
fix-prerender-failure-reporting
branch
from
August 31, 2026 08:23
c5021a0 to
1dadd3d
Compare
clydin
approved these changes
Aug 31, 2026
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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