Angular-cli: Library prod build fails: no "production" configuration

Created on 17 Sep 2018  路  4Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [X] bug report
- [ ] 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 --version
v10.8.0

npm --version
6.4.1

ng --version
Angular CLI: 6.2.2
Node: 10.8.0
OS: darwin x64
Angular: 6.1.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.8.2
@angular-devkit/build-angular      0.8.2
@angular-devkit/build-ng-packagr   0.8.2
@angular-devkit/build-optimizer    0.8.2
@angular-devkit/build-webpack      0.8.2
@angular-devkit/core               0.8.2
@angular-devkit/schematics         0.8.2
@angular/cli                       6.2.2
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.2.2
@schematics/angular                0.8.2
@schematics/update                 0.8.2
ng-packagr                         4.1.1
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.19.0

Repro steps

ng new example-app
cd example-app
ng generate library example-lib
ng build example-lib --prod

The log given by the failure

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

Desired functionality


To be able to execute a --prod build on a library.

Mention any other details that might be useful


According to the Create a Library story, a build with the --prod should be done before publishing a library. In this case that command fails out of the box. I know the CLI relies on ng-packagr for library builds, but this seems like an issue that should be addressed on the CLI side.

docs

Most helpful comment

Thanks for pointing this out. It looks like the documentation is out-of-date. the --prod is no longer needed as the library is always build in AOT mode and without the --prod it does clean the previous files as well.

All 4 comments

Thanks for pointing this out. It looks like the documentation is out-of-date. the --prod is no longer needed as the library is always build in AOT mode and without the --prod it does clean the previous files as well.

@alan-agius4, thanks for verifying that! That was my suspicion but I just wanted to be sure.

Thanks a lot.

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

NCC1701M picture NCC1701M  路  3Comments

jbeckton picture jbeckton  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments