Skip to content

Do Not Deprecate baseHref in i18n Configuration #29396

Closed
@jusfeel

Description

@jusfeel

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:

  1. Want locale-specific builds in subdirectories (subPath) without altering the <base> tag in index.html.
  2. Depend on a static baseHref for 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:

  1. baseHref takes precedence if defined. This ensures that:

    • The <base> tag in index.html uses baseHref for all builds.
    • subPath is only used for structuring the output directory, not modifying index.html.
  2. If baseHref is not specified, the current subPath behavior 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.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions