Always inline Angular resources regardless of compilation mode#22
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Forces Angular resource files (e.g., HTML templates) to be linked alongside the component output in every compilation mode, not just opt. This unblocks Angular 15's TestBed which can no longer resolve external templateUrl files via XHR in jsdom, fixing test failures during the Angular 14 → 15 upgrade.
Changes:
- Replaces the
compilation_mode == "opt"check on the resource-linking branch with an unconditionalif True:, effectively making resource linking always execute.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Remove the conditional that only linked resources in opt mode. Resources are now always linked next to the component output so Angular's TestBed can resolve templateUrl in all compilation modes. Previously, fastbuild mode ran a resource compiler that converted HTML to JS modules (exports.content). This is no longer needed — Angular resolves resources directly from the linked files.
8d1ebac to
1b2c14a
Compare
TreyLavery
approved these changes
May 18, 2026
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.
Summary
In fastbuild mode, Angular resources (HTML templates) were only processed through the resource compiler (HTML → JS module with
exports.content). The raw HTML files were not linked next to the component output.This causes Angular 15's TestBed to fail with "Component not resolved: templateUrl" because it can no longer resolve external templates via XHR in jsdom test environments.
This change makes the resource linking path (previously opt-only) run in all compilation modes.
Impact on other consumers
Safe for all consumers of this repo:
exports.content) are no longer produced, but no known consumer imports them directly — they exist only as an intermediary for Angular's template resolution.TODO
Using
if True:with a still-presentelse:branch leaves dead code and obscures intent. Since resources should now always be linked, remove the conditional entirely (along with the dead else branch) and inline thelink_filecall directly in the loop.Testing
Verified on the
rivetrepo:--compilation_mode=opt(which uses this same code path)Context
Part of the Angular 14 → 15 upgrade in Rivet (RVT-23199).