Skip to content

Commit 8816b4f

Browse files
committed
fix(@angular/build): consistently set "default" baseHref
Previously, the default value for baseHref (set to `/`) was defined in multiple places, leading to inconsistency. A recent commit inadvertently removed one of these defaults see: https://github.com/angular/angular-cli/pull/28283/files#diff-803b0bd9e1fd57eefba877e946b85b13517170ad5fadb906a11308bc4b3b9fdaL148 This change consolidates the default logic by removing redundant definitions and moving the default baseHref configuration to schema.json for consistency. Closes angular#28442
1 parent b65ef44 commit 8816b4f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

packages/angular/build/src/builders/application/execute-post-bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export async function executePostBundleSteps(
6060
const prerenderedRoutes: PrerenderedRoutesRecord = {};
6161

6262
const {
63-
baseHref = '/',
63+
baseHref,
6464
serviceWorker,
6565
indexHtmlOptions,
6666
optimizationOptions,

packages/angular/build/src/builders/application/options.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,18 @@ export async function normalizeOptions(
350350

351351
// Initial options to keep
352352
const {
353+
/**
354+
* Note: These default values should match those in schema.json.
355+
* The reason these defaults are defined here is that, in certain internal builders,
356+
* they are either not set or the options are provided.
357+
*/
358+
baseHref = '/',
359+
inlineStyleLanguage = 'css',
353360
allowedCommonJsDependencies,
354361
aot,
355-
baseHref,
356362
crossOrigin,
357363
externalDependencies,
358364
extractLicenses,
359-
inlineStyleLanguage = 'css',
360365
outExtension,
361366
serviceWorker,
362367
poll,

packages/angular/build/src/builders/application/schema.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,8 @@
315315
},
316316
"baseHref": {
317317
"type": "string",
318-
"description": "Base url for the application being built."
318+
"description": "Specifies the base URL for the application, used to resolve all relative URLs within the app.",
319+
"default": "/"
319320
},
320321
"verbose": {
321322
"type": "boolean",
@@ -536,7 +537,7 @@
536537
}
537538
},
538539
"additionalProperties": false,
539-
"required": ["outputPath", "index", "browser", "tsConfig"],
540+
"required": ["outputPath", "index", "browser", "tsConfig", "inlineStyleLanguage", "baseHref"],
540541
"definitions": {
541542
"assetPattern": {
542543
"oneOf": [

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy