10.1.0 i18n compilation error: Localized bundle generation failed: Cannot read property ‘value’ of undefined

🐞 bug report

Affected Package

Angular 10.1.0

Is this a regression?

Yes, no issues with 10.0.x (all of them)

Description

Upgrading our project to 10.1.0

ng update @angular/core @angular/cli --force

No issues, upgrade goes through without issues.

However, when doing a production build I get this error:

Localized bundle generation failed: Cannot read property 'value' of undefined

I am using i18n with 3 languages.

🌍 Your Environment

Angular Version:


Angular CLI: 10.0.8
Node: 12.13.1
OS: darwin x64

Angular: 10.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: 

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1000.8
@angular-devkit/build-angular      0.1000.8
@angular-devkit/build-optimizer    0.1000.8
@angular-devkit/build-webpack      0.1000.8
@angular-devkit/core               10.0.8
@angular-devkit/schematics         10.0.8
@angular/cdk                       10.0.1
@angular/cli                       10.0.8
@angular/fire                      6.0.2
@angular/material                  10.0.1
@angular/material-moment-adapter   10.0.1
@ngtools/webpack                   10.0.8
@schematics/angular                9.1.6
@schematics/update                 0.1000.8
rxjs                               6.5.5
typescript                         3.9.6
webpack                            4.43.0

🌍 angular.json


{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "selfservice": {
      "i18n": {
        "locales": {
          "da": "src/locale/messages.da.xlf",
          "sv": "src/locale/messages.sv.xlf",
          "en": "src/locale/messages.en.xlf"
        }
      },
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {
        "@schematics/angular:component": {
          "style": "sass"
        }
      },
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/robots.txt",
              "src/favicon.png",
              "src/assets",
              "src/browserconfig.xml",
              "src/manifest.json",
              {
                "glob": "**/*",
                "input": "./assets",
                "output": "assets/"
              }
            ],
            "styles": [
              "./node_modules/material-icons/iconfont/material-icons.scss",
              "src/styles/index.scss"
            ],
            "scripts": [
              "./node_modules/file-saver/dist/FileSaver.min.js",
              "src/assets/js/modernizr.js"
            ]
          },
          "configurations": {


            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "localize": [
                "da", "sv", "en"
              ],
              "optimization": true,
              "outputHashing": "bundles",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": true,
              "buildOptimizer": true,
              "serviceWorker": true,
              "outputPath": "dist"
            },
            "da": {
              "aot": true,
              "localize": [
                "da"
              ],
              "outputPath": "dist"
            },
            "sv": {
              "aot": true,
              "localize": [
                "sv"
              ],
              "outputPath": "dist"
            },
            "en": {
              "aot": true,
              "localize": [
                "en"
              ],
              "outputPath": "dist"
            },
            "integration": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.integration.ts"
                }
              ],
              "aot": true,
              "localize": [
                "en"
              ],
              "outputPath": "dist"
            },


            "staging": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ],
              "localize": [
                "da", "sv", "en"
              ],
              "optimization": true,
              "outputHashing": "bundles",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": true,
              "buildOptimizer": true,
              "serviceWorker": true,
              "outputPath": "dist"
            },
           
            "test": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.test.ts"
                }
              ],
              "localize": [
                "da", "sv", "en"
              ],
              "optimization": true,
              "outputHashing": "bundles",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": true,
              "buildOptimizer": true,
              "serviceWorker": true,
              "outputPath": "dist"
            }
  
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "selfservice:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "selfservice:build:production"
            },
            "integration": {
              "browserTarget": "selfservice:build:integration"
            },
            "da": {
              "browserTarget": "selfservice:build:da"
            },
            "sv": {
              "browserTarget": "selfservice:build:sv"
            },
            "en": {
              "browserTarget": "selfservice:build:en"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "selfservice:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "karmaConfig": "src/karma.conf.js",
            "styles": [
              "src/styles.sass"
            ],
            "scripts": [],
            "assets": [
              "src/favicon.ico",
              "src/assets",
              "src/manifest.json"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "selfservice-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "prefix": "",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "selfservice:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "selfservice:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "selfservice",
  "cli": {
    "analytics": "e39974f2-c043-437e-ad6b-c5bb38cf1079"
  }
}

1 possible answer(s) on “10.1.0 i18n compilation error: Localized bundle generation failed: Cannot read property ‘value’ of undefined

  1. Could it be that this is an issue with CLI 10.0, but not the to be released CLI 10.1?

    i had the same error using cli 10. after upgrading cli to 10.1 the problem has gone!