Configuration 'production' is not set in the workspace when --prod and -c flags set

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • 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


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

🌍 Your Environment


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

Anything else relevant? Shouldn’t be anything else.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

11reactions
redevillcommented, Mar 4, 2020

Hey guys,

Anyone coming in for the first time creating lib, i’m sure will be reading this: https://angular.io/guide/creating-libraries

It specifically details the need not to use Ivy and use the --prod option as below screen shot. If you follow the instructions, you also get the “Configuration ‘production’ is not set…” error. Please can someone advise me? Adjust the documentation?

image

5reactions
ciekawycommented, Apr 8, 2020

in addition I’ve just found --aot option is not available for libraries (as libraries are being build in AOT mode be fault?)

https://github.com/angular/angular-cli/issues/13328

OTOH what worked for me as per https://angular.io/guide/ivy there is dedicated tsconfig option to disable ivy - I’ve put it in each of my libraries in tsconfig.lib.conf existing there and dedicated for building a library:

  "angularCompilerOptions": {
    "enableIvy": false
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuration 'production' is not set in the workspace - Stack ...
You are building with --prod , which means to use the production configuration, which you obviously removed. You need to change your build ......
Read more >
Configuration 'production' is not set in the workspace - Angular ...
Coding example for the question Configuration 'production' is not set in the workspace - Angular-angular.js.
Read more >
ng build - Angular
A "production" configuration is created by default when you use the CLI to create the project, and you can use that configuration by...
Read more >
Angular workspace configuration
You can override Angular CLI defaults set at the workspace level through ... of the configuration file does not correspond exactly to the...
Read more >
Angular CLI - ng serve Command - Tutorialspoint
Sr.No. Option & Syntax Description 2 ‑‑aot=true|false Build using Ahead of Time compilation. 3 ‑‑baseHref=baseHref Base url for the application being built. 7 ‑‑deployUrl=deployUrl URL where...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found