From 1b2c14a38bbd6824239ed7ec101efa6cc3cbcf11 Mon Sep 17 00:00:00 2001 From: Kirk Peterson Date: Mon, 18 May 2026 14:58:14 +0000 Subject: [PATCH] Always inline Angular resources regardless of compilation mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- angular/rules.bzl | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/angular/rules.bzl b/angular/rules.bzl index b6c05025..05154015 100644 --- a/angular/rules.bzl +++ b/angular/rules.bzl @@ -90,46 +90,17 @@ def _angular_library(ctx): ts = [] outputs = [] - # resource + # resource — always link files next to output so Angular can resolve templateUrl for file in ctx.files.resources: - if compilation_mode == "opt": - inputs.append( - link_file( - actions = actions, - file = file, - label = label, - output = output_, - ), - ) - else: - js_path_ = output_name( + inputs.append( + link_file( + actions = actions, file = file, label = label, - prefix = js_prefix, - strip_prefix = strip_prefix, - ) - if not file.is_directory: - js_path_ = resource_path(js_path_) - js_ = actions.declare_file(js_path_) - js.append(js_) - args = actions.args() - args.add(file) - args.add(js_) - args.set_param_file_format("multiline") - args.use_param_file("@%s", use_always = True) - actions.run( - arguments = [args], - executable = compiler.resource_compiler.files_to_run.executable, - execution_requirements = { - "requires-worker-protocol": "json", - "supports-workers": "1", - }, - inputs = [file], - mnemonic = "TypeScriptTranspile", - outputs = [js_], - tools = [compiler.resource_compiler.files_to_run], - ) + output = output_, + ), + ) if compilation_mode != "opt": transpile_tsconfig = actions.declare_file("%s/js-tsconfig.json" % ctx.attr.name)