Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sebastian-zarzycki-apzumi opened this issue Jun 5, 2018 · 6 comments

Comments

@sebastian-zarzycki-apzumi
Copy link

sebastian-zarzycki-apzumi commented Jun 5, 2018

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.

@faisalmuhammad
Copy link
Contributor

@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.

@sebastian-zarzycki-apzumi
Copy link
Author

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.

@clydin
Copy link
Member

clydin commented Jun 6, 2018

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 clydin closed this as completed Jun 6, 2018
@sebastian-zarzycki-apzumi
Copy link
Author

"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.

@funky-jojo
Copy link

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants