我尝试使用我的特定配置为我的Angular应用程序提供服务,但Angular无法识别它:
$ ng serve --configuration=fr
An unhandled exception occurred: Configuration 'fr' is not set in the workspace.
See "/tmp/ng-nyZPjp/angular-errors.log" for further details.我的angular.json:
"configurations": {
"fr": {
"aot": true,
"outputPath": "dist/fr/",
"i18nFile": "src/i18n/messages.fr.xlf",
"i18nFormat": "xlf",
"i18nLocale": "fr",
"i18nMissingTranslation": "error",
"baseHref": "/fr/"
},
"en": {
"aot": true,
"outputPath": "dist/en/",
"i18nFile": "src/i18n/messages.en.xlf",
"i18nFormat": "xlf",
"i18nLocale": "en",
"i18nMissingTranslation": "error",
"baseHref": "/en/"
},
...ng serve --configuration=en完美工作
发布于 2022-01-01 21:28:53
我在Angular Universal V12.x中遇到了相同的错误,Angular.json文件中的以下代码修复了我的错误(将serve-ssr部分替换为以下代码):
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"options": {
"browserTarget": "yourAppName:build",
"serverTarget": "yourAppName:server"
},
"configurations": {
"production": {
"browserTarget": "yourAppName:build:production",
"serverTarget": "yourAppName:server:production"
}
}
}https://stackoverflow.com/questions/58876170
复制相似问题