Skip to content

Commit 2b00bca

Browse files
committed
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 d50d09f)
1 parent da4fcad commit 2b00bca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/compiler-plugin.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ export function createCompilerPlugin(
213213
// The AOT compiler currently requires this hook to allow for a transformResource hook.
214214
// Once the AOT compiler allows only a transformResource hook, this can be reevaluated.
215215
(host as CompilerHost).readResource = async function (fileName) {
216-
// Template resources (.html) files are not bundled or transformed
217-
if (fileName.endsWith('.html')) {
216+
// Template resources (.html/.svg) files are not bundled or transformed
217+
if (fileName.endsWith('.html') || fileName.endsWith('.svg')) {
218218
return this.readFile(fileName) ?? '';
219219
}
220220

0 commit comments

Comments
 (0)