Skip to content

Commit b93708c

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 ea4a125 commit b93708c

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
@@ -52,7 +52,7 @@ export async function executePostBundleSteps(
5252
const prerenderedRoutes: string[] = [];
5353

5454
const {
55-
baseHref = '/',
55+
baseHref,
5656
serviceWorker,
5757
indexHtmlOptions,
5858
optimizationOptions,

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

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

306306
// Initial options to keep
307307
const {
308+
/**
309+
* Note: These default values should match those in schema.json.
310+
* The reason these defaults are defined here is that, in certain internal builders,
311+
* they are either not set or the options are provided.
312+
*/
313+
baseHref = '/',
314+
inlineStyleLanguage = 'css',
308315
allowedCommonJsDependencies,
309316
aot,
310-
baseHref,
311317
crossOrigin,
312318
externalDependencies,
313319
extractLicenses,
314-
inlineStyleLanguage = 'css',
315320
outExtension,
316321
serviceWorker,
317322
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",
@@ -531,7 +532,7 @@
531532
}
532533
},
533534
"additionalProperties": false,
534-
"required": ["outputPath", "index", "browser", "tsConfig"],
535+
"required": ["outputPath", "index", "browser", "tsConfig", "inlineStyleLanguage", "baseHref"],
535536
"definitions": {
536537
"assetPattern": {
537538
"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