Angular-cli: ng build --prod <library name> fails

Created on 10 Sep 2018  路  2Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

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

Versions


node 10.10.0
npm 6.4.1
ng 6.1.7

Angular CLI: 6.2.1
Node: 10.10.0
OS: win32 x64
Angular:
...

Package Version

@angular-devkit/architect 0.8.1
@angular-devkit/core 0.8.1
@angular-devkit/schematics 0.8.1
@schematics/angular 0.8.1
@schematics/update 0.8.1
rxjs 6.2.2
typescript 2.9.2

Repro steps


Create a new angular project using ng new test1
Create a new library inside the project using new g library lib-test
npm i
ng build --prod lib-test

The log given by the failure


Configuration 'production' could not be found in project '...'.
Error: Configuration 'production' could not be found in project '...'.
at Architect.getBuilderConfiguration (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\src\architect.js:102:23)
at MergeMapSubscriber._loadWorkspaceAndArchitect.pipe.operators_1.concatMap [as project] (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:70:55)
at MergeMapSubscriber._tryNext (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:65:27)
at MergeMapSubscriber._next (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
at TapSubscriber._next (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\tap.js:62:26)
at TapSubscriber.Subscriber.next (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
at InnerSubscriber._next (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\InnerSubscriber.js:25:21)
at InnerSubscriber.Subscriber.next (C:\Users...\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)

Desired functionality


if I use ng build lib-test , is working very well.

in the angular.json file, this version of @angular/cli, do not added automatically the neccesary :
"configurations": {
"production": {
"devServerTarget": "test1:serve:production"
}
}

and did not created the file: ng-packagr.prod.json

If I add those manually, the ng build --prod lib-test command, works just fine. So the issue is the fact that the above file and code is missing.

Mention any other details that might be useful

Most helpful comment

Angular CLI no longer creates a production for libraries, as there is a single ng-packagr configuration. Since previously two different confiurations were dist folder was kept for none --prod builds.

Unless you create a production configuration you shouldn't be needing --prod for libraries.

All 2 comments

Angular CLI no longer creates a production for libraries, as there is a single ng-packagr configuration. Since previously two different confiurations were dist folder was kept for none --prod builds.

Unless you create a production configuration you shouldn't be needing --prod for libraries.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmurphzyo picture jmurphzyo  路  3Comments

jbeckton picture jbeckton  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments