I've installed the angular localize package, and it's working locally, but when I try to build to production I got this error:
Localized bundle generation failed: Cannot read properties of undefined (reading 'file')
I'm using Angular: 10.2.5. If I run ng server
the project builds and I can see the translation. I have more projects inside the same structure.
My angular.json
file:
{
"sport": {
...
"i18n": {
"sourceLocale": "de",
"locales": {
"en": "apps/sport/locale/messages.en.xlf"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
"localize": true,
"aot": true
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/sport/src/environments/environment.ts",
"with": "apps/sport/src/environments/environment.prod.ts"
}
],
...
"sourceMap": true
},
"en": {
"aot": true,
"localize": ["en"]
},
"e2e": {
"fileReplacements": [
{
"replace": "apps/sport/src/environments/environment.ts",
"with": "apps/sport/src/environments/environment.e2e.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "sport:build",
"port": 4201
},
"configurations": {
"production": {
"browserTarget": "sport:build:production"
},
"en": {
"browserTarget": "sport:build:en"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "sport:build"
}
}
}
}
}