Skip to content

Library docs say to build lib --prod but it fails. #12333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
escalonn opened this issue Sep 20, 2018 · 2 comments
Closed

Library docs say to build lib --prod but it fails. #12333

escalonn opened this issue Sep 20, 2018 · 2 comments

Comments

@escalonn
Copy link

escalonn commented Sep 20, 2018

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
- [x] doc

Versions

$ node --version
v8.11.2
npm --version
6.4.1
$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.2.3
Node: 8.11.2
OS: win32 x64
Angular: 6.1.8
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.8.3
@angular-devkit/build-angular      0.8.3
@angular-devkit/build-ng-packagr   0.8.3
@angular-devkit/build-optimizer    0.8.3
@angular-devkit/build-webpack      0.8.3
@angular-devkit/core               0.8.3
@angular-devkit/schematics         0.8.3
@angular/cli                       6.2.3
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.2.3
@schematics/angular                0.8.3
@schematics/update                 0.8.3
ng-packagr                         4.2.0
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.19.1

Windows 10.

Repro steps

  1. ng new my-app
  2. cd my-app
  3. ng generate library my-lib
  4. ng build my-lib --prod

The log given by the failure

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

Desired functionality

According to create library story in wiki documentation, to publish my library I should run ng build my-lib --prod. ("The --prod flag should be used when building to publish because it will completely clean the build directory for the library beforehand, removing old code leftover code from previous versions.")

As far as I can tell, generate library has since been updated to not add a production configuration for the project, and to just make the regular build clear dist/my-lib.

So the documentation should be updated to reflect this.

But I am not an Angular expert and I would like to be sure whether when an application which includes the library is built with --prod, the typical benefits of it (AOT, etc.) are still provided to the library code and not just the application code.

Mention any other details that might be useful

Possibly #10710 related.

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Sep 21, 2018

Duplicate of #12290

@alan-agius4 alan-agius4 marked this as a duplicate of #12290 Sep 21, 2018
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants