From 2b00bca615a2c79b0a0311c83cb9f1450b6f1745 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 26 Aug 2022 10:55:47 -0400 Subject: [PATCH] fix(@angular-devkit/build-angular): allow esbuild-based builder to use SVG Angular templates The experimental esbuild-based browser application builder will now consider SVG files as Angular component templates. Previously, only HTML files were considered templates and this resulted in the esbuild-based builder to try to process the SVG file as a stylesheet. (cherry picked from commit d50d09f98da9561bf3faf2df3e843de01b6f2f2b) --- .../src/builders/browser-esbuild/compiler-plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts index a55e95ff4992..40fbe0129d98 100644 --- a/packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts +++ b/packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts @@ -213,8 +213,8 @@ export function createCompilerPlugin( // The AOT compiler currently requires this hook to allow for a transformResource hook. // Once the AOT compiler allows only a transformResource hook, this can be reevaluated. (host as CompilerHost).readResource = async function (fileName) { - // Template resources (.html) files are not bundled or transformed - if (fileName.endsWith('.html')) { + // Template resources (.html/.svg) files are not bundled or transformed + if (fileName.endsWith('.html') || fileName.endsWith('.svg')) { return this.readFile(fileName) ?? ''; }