How to fix 'ng build' not building localized with @angular/localize

Problem

You are using @angular/localize to localize your Angular app, but ng build doesn’t build the localized versions. In other words, dist/myapp/index.html exists, but dist/myapp/en/index.html doesn’t.

Solution

You need to add localize: true to your build options in angular.json.

Excerpt:

  "architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:application",
      "options": {
        "localize": true
      }
    }
  }

Typically, architect/build/options already exists, so you just need to add the localize: true line.

Don’t forget to add the comma at the end of the line before the new line.

After you’ve made this change, ng build will build the localized versions of your app.