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:
- Created 4 years ago
- Reactions:12
- Comments:15 (6 by maintainers)
Top Related StackOverflow Question
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?
in addition I’ve just found
--aotoption 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
tsconfigoption to disable ivy - I’ve put it in each of my libraries intsconfig.lib.confexisting there and dedicated for building a library: