FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(@angular/build): fail build and exclude routes when prerendering fails by alan-agius4 · Pull Request #33971 · angular/angular-cli · GitHub

Repository navigation

fix(@angular/build): fail build and exclude routes when prerendering fails - #33971

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-prerender-failure-reporting
Aug 31, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-prerender-failure-reporting

Conversation

Copy link
Copy Markdown
Collaborator

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 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 #33965

gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Aug 31, 2026
alan-agius4 requested a review from clydin August 31, 2026 08:21
alan-agius4 force-pushed the fix-prerender-failure-reporting branch from 7ce0519 to c5021a0 Compare August 31, 2026 08:22
…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 c5021a0 to 1dadd3d Compare August 31, 2026 08:23
alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 31, 2026
alan-agius4 merged commit 5b850fd into angular:main Aug 31, 2026
66 of 68 checks passed
alan-agius4 deleted the fix-prerender-failure-reporting branch August 31, 2026 13:10

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

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

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prerendering reports routes it did not write, and the build succeeds

2 participants


Back | FazBrowse Home | New Git URL