Useful or not, from you.
angular Configuration 'production' is not set in the workspace when --prod and -c flags set

🐞 Bug report

Command (mark with an x)

  • [ ] new
  • [x] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc

Is this a regression?

Yes, this command did not generate errors using Angular 8

Description

We have renamed the production build configuration to "release" in our angular.json file for internal consistency. Prior to upgrading to Angular 9 this worked without issue. Now when we run ng build -c=release --prod --aot we get the following error.

An unhandled exception occurred: Configuration 'production' is not set in the workspace.

While we can rename our release configuration to production we have a lot of projects and it breaks our internal naming convention. Since it was working prior to the upgrade we thought it was worth bringing up here before we refactor.

🔬 Minimal Reproduction

Create a new Angular project using the CLI. Rename the production build configuration to release (or anything else). Run ng build -c=release --prod --aot Get Error

🔥 Exception or Error

<pre><code> An unhandled exception occurred: Configuration 'production' is not set in the workspace. </code></pre>

🌍 Your Environment

<pre><code> Angular CLI: 9.0.2 Node: 10.15.0 OS: win32 x64

Angular: 9.0.1 ... animations, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, router Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.900.2 @angular-devkit/build-angular 0.900.2 @angular-devkit/build-optimizer 0.900.2 @angular-devkit/build-webpack 0.900.2 @angular-devkit/core 9.0.2 @angular-devkit/schematics 9.0.2 @angular/cli 9.0.2 @ngtools/webpack 9.0.2 @schematics/angular 9.0.2 @schematics/update 0.900.2 rxjs 6.5.3 typescript 3.7.5 webpack 4.41.2

</code></pre>

Anything else relevant? Shouldn't be anything else.

That's a useful answer
Without any help

@ahsteele In regards to the --prod option, yes. If the goal is a production build then the options within the release configuration would also be relevant. The following is the set of options present in a production configuration for a new 9.0 project (AOT is enabled in the options section and is used for both development and production builds now):

            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }