-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Which @angular/* package(s) are relevant/related to the feature request?
localize
Description:
The recent deprecation of the baseHref field in the i18n.sourceLocale configuration causes significant issues for projects that rely on a shared base URL for multiple localized builds.
While the subPath feature is a welcome addition for structuring locale builds, it is limiting for developers who:
- Want locale-specific builds in subdirectories (
subPath) without altering the<base>tag inindex.html. - Depend on a static
baseHreffor all builds due to server or application constraints.
Current Behavior:
With subPath enabled:
Angular modifies the <base href> tag in index.html to include the locale-specific subpath (e.g., /zh-hans/), and there is no built-in way to override this behavior.
Without baseHref:
Developers are forced to implement error-prone and maintenance-heavy post-build scripts to reset the <base> tag to their desired value.
Expected Behavior:
Projects with subPath configured should still have the option to:
Use baseHref as a static value across all locale builds.
Separate the functionality of subPath (output directory) from the <base> tag in index.html.
Proposed solution
Instead of fully deprecating baseHref, it could coexist with subPath to give developers more flexibility. Suggested behavior:
-
baseHreftakes precedence if defined. This ensures that:- The
<base>tag inindex.htmlusesbaseHreffor all builds. - subPath is only used for structuring the output directory, not modifying
index.html.
- The
-
If
baseHrefis not specified, the currentsubPathbehavior remains unchanged.
Alternatives considered
Developers are forced to implement error-prone and maintenance-heavy post-build scripts to reset the tag to their desired value.