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.
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
works perfectly
A file named angular. json at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults for build and development tools provided by the Angular CLI. Path values given in the configuration are relative to the root workspace folder.
browserTarget is a setting that maps a configuration to a build target e.g. build , serve , test , lint .
The angular-cli. json should be located in the root folder of the project. This is using the latest version "@angular/cli": "1.0. 0-beta.
First, let's start by defining what is an Angular Workspace: A workspace is a set of Angular applications and libraries. The angular. json file at the root level of an Angular workspace provides workspace-wide and project-specific (application or library) configuration defaults for build and development tools.
The error you are getting is because you didn't add it to your serve browserTarget configuration:
"serve":{ "fr": { "browserTarget": "custom-reports:build:fr" }, }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With