角度-在工作区中未设置配置 [英] Angular - Configuration is not set in the workspace

查看:96
本文介绍了角度-在工作区中未设置配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用特定配置为Angular应用提供服务,但是Angular无法识别它:

I try to serve my Angular app with my specific configuration but Angular does not recognize it :

$ 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:

My 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 效果很好

推荐答案

您收到的错误是因为您没有将其添加到服务浏览器目标配置中:

The error you are getting is because you didn't add it to your serve browserTarget configuration:

"serve":{
   "fr": {
            "browserTarget": "custom-reports:build:fr"
         },
 }

这篇关于角度-在工作区中未设置配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆