我正在构建一个使用Angular国际化工具的应用程序。我已经成功为每种语言(en,fr,gb)构建了AOT生产版本,但是在为禁用AOT的每种语言构建开发版本时遇到了麻烦,因此我们可以在运行时进行调试。
我正在使用Angular 7.2.11
我的angular.json
的摘录如下:
{
"projects": {
"SupplierPortal": {
\,
"architect": {
"build": {
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"fr": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.fr.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"outputPath": "dist/SupplierPortal-fr",
"i18nFile": "src/locale/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr"
},
"de": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.de.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
],
"outputPath": "dist/SupplierPortal-de",
"i18nFile": "src/locale/messages.de.xlf",
"i18nFormat": "xlf",
"i18nLocale": "de"
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "SupplierPortal:build"
},
"configurations": {
"production": {
"browserTarget": "SupplierPortal:build:production"
},
"fr": {
"browserTarget": "SupplierPortal:build:fr",
"aot": false
},
"de": {
"browserTarget": "SupplierPortal:build:de",
"aot": false
}
}
}
}
}
我看过documentation for JIT builds,但看不到如何为多种语言进行配置。
我确实尝试过为每种语言关闭JIT:
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "SupplierPortal:build"
},
"configurations": {
"fr": {
"browserTarget": "SupplierPortal:build:fr",
"buildOptimizer": false,
"aot": false
}
}
}
但是JIT编译器抱怨:
架构验证失败,出现以下错误: 数据路径“”不应具有其他属性(buildOptimizer)。
我如何ng serve
在AOT关闭的情况下使用语言配置,同时在AOT打开的情况下维持生产版本?