From 09852ddb78c3a43dc13c6a8f76d9affbb5f15342 Mon Sep 17 00:00:00 2001 From: BBBoy01 <1156678002@qq.com> Date: Sat, 14 Sep 2024 15:08:45 +0800 Subject: [PATCH] feat(build): add fallback baseHref --- .../src/utils/index-file/augment-index-html.ts | 2 +- .../utils/index-file/augment-index-html_spec.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/angular/build/src/utils/index-file/augment-index-html.ts b/packages/angular/build/src/utils/index-file/augment-index-html.ts index 30d5f30d2b6e..bf0e4fdfc364 100644 --- a/packages/angular/build/src/utils/index-file/augment-index-html.ts +++ b/packages/angular/build/src/utils/index-file/augment-index-html.ts @@ -72,7 +72,7 @@ export async function augmentIndexHtml( sri, deployUrl = '', lang, - baseHref, + baseHref = '/', html, imageDomains, } = params; diff --git a/packages/angular/build/src/utils/index-file/augment-index-html_spec.ts b/packages/angular/build/src/utils/index-file/augment-index-html_spec.ts index 61aaa0674ed8..fc434fc696d6 100644 --- a/packages/angular/build/src/utils/index-file/augment-index-html_spec.ts +++ b/packages/angular/build/src/utils/index-file/augment-index-html_spec.ts @@ -53,6 +53,22 @@ describe('augment-index-html', () => { `); }); + it('should generate base href with fallback value', async () => { + const { content } = await augmentIndexHtml({ + ...indexGeneratorOptions, + baseHref: undefined, + }); + + expect(content).toEqual(oneLineHtml` + +