angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

[feature-request] Specify default configuration in angular.json, if no configuration provided

Open sebastian-zarzycki-apzumi opened this issue 8 years ago • 6 comments

Provide a way to specify a default configuration in angular.json, if no configuration is provided in commandline or otherwise.

If I understand correctly "dev" was the default configuration in Angular <=5, but it doesn't seem to be the case in Angular 6. Since we're now specifying configurations in a more detailed way (not just environment parameter), I think it would be useful to have a way to define which configuration is the default one. This would eliminate potential issues of "ng serve" vs "ng serve -c dev" and so on.

Technically, the "default" options could be specified directly within particular sections of angular.json (outside of configuration section), but I don't think it's a clean and desired solution. Defining configurations in their separate place seems readable and easier to maintain.

@sebastian-zarzycki-es, the build:options section is exactly for that purpose. You can specify your default configuration there and overwrite the options in build:configurations section.

faisalmuhammad avatar Jun 06 '18 07:06 faisalmuhammad

Like I said, I don't believe this to be a proper solution. It's harder to maintain and less readable. I don't like having fileReplacements directly within "options" either. It's no longer an option, it's a specific action performed.

fileReplacements is indeed an option (in fact, its implementation does not actually replace anything; it merely maps a path to a different path at build time). Configurations are nothing more than a set of additive options. The intent of the design is to limit the repetition of configuration parameters within the build configurations. The less repetition; the less chance for errors. Configurations are also completely optional and for some builder/project setups may be completely unnecessary. There are no current plans to change this at this time but thank you for the feedback. Changes and modifications to the configuration system will be reviewed for the 7.0 release and usability concerns such as this will be part of the discussion.

clydin avatar Jun 06 '18 13:06 clydin

"The intent of the design is to limit the repetition of configuration parameters within the build configurations. The less repetition; the less chance for errors."

Configuration file in text form is for human, not for computer. You're adding additional step for a human to mentally parse options section and then merge/override/replace them with what's found in configuration section. That's actually higher chance for errors.

The problem is there's no good way to modify the default configuration that is used if someone simply runs ng serve

funky-jojo avatar Feb 10 '19 12:02 funky-jojo

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.