Skip to content

ng build ignores locale.baseHref #20712

@e-oz

Description

@e-oz

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Looks so

Description

With this config:

      "i18n": {
        "sourceLocale": {
          "code": "en-US",
          "baseHref": ""
        },
        "locales": {
          "de": {
            "baseHref": "",
            "translation": "projects/project_name/src/i18n/messages.de.xlf"
          }
        }
      },
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "configurations": {
            "production": {
              "localize": ["de"],

ng build ignores "baseHref" of the locale and always adds "de".
If configurations.production.localize set to "true", then it will add "de" for some files an "en-US" for others.

Would be awesome if empty baseHref had effect, described here: https://stackoverflow.com/a/61384524/680786 (not adding any prefix)

🌍 Your Environment


Angular CLI: 12.0.0-rc.2
Package Manager: npm 7.11.2

Angular: 12.0.0-rc.2
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0-rc.2
@angular-devkit/build-angular   12.0.0-rc.2
@angular-devkit/core            12.0.0-rc.2
@angular-devkit/schematics      12.0.0-rc.2
@schematics/angular             12.0.0-rc.2
ng-packagr                      12.0.0-rc.1
rxjs                            7.0.0
typescript                      4.2.4

Reproduced on Linux and Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions