-
Notifications
You must be signed in to change notification settings - Fork 12k
[cli] Alternate build configurations not working as expected with ng serve #19013
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
Comments
Hi @kawazoe, When using From the use-case explained above, instead of specifying addition configurations under the dev-server builder, it would be better to use the
|
Thanks for the quick reply! This is some great info. The docs do not hint that comma-separated values can be used anywhere else than the configuration parameter. It would be great if this was made more clear in the docs. |
The browser-target is in the format of There is already an issue to better describe this: #16572 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 bug report
Affected Package
The is an issue in package @angular/cli. Specifically related to this entry in the documentation: https://angular.io/guide/workspace-config#alternate-build-configurations
Description
The documentation states that multiple configurations can be provided using a comma-separated list, like so:
--configuration=state,fr
, and that the last one will take precedence.This behavior works perfectly fine when using
ng build --configuration=foo,bar
but the implementation breaks down withng serve
. Since the serve command usesbrowserTarget
to select a build configuration, a configuration setup that works for the build command cannot be tested using the serve command.🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-ivy-6kdefg?file=angular.json
Running
ng build --configuration=production,noaot
will correctly disable the aot compiler while keeping the other production settings.Running
ng serve --configuration=production,noaot
will cause the build to use ONLY the noaot settings since they all end up bundled under thebrowserTarget
key.🔥 Exception or Error
This behavior renders the multi-configuration support pretty much useless as it forces developers to choose between using
ng serve
or using this feature.While some properties can be directly overrided in the
serve
schema, not all can be customized. For instance, budgets and file replacements cannot be changed by theserve
configuration, which makes it impossible to do something like this:ng serve --configuration=qa,optimized
Where
qa
would only provide file replacements andoptimized
would turn on aot, turn off source maps, etc.This is an issue for my team since we manage a project with 16 different environments that could be expressed with only 7 configurations if we could use
ng serve
together with comma-separated configurations.🌍 Your Environment
Angular Version:
The text was updated successfully, but these errors were encountered: