Skip to content

Library prod build fails: no "production" configuration #12290

Closed
@cjlaw

Description

@cjlaw

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.

Metadata

Metadata

Assignees

Labels

area: docsRelated to the documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions