Skip to content

Build with --watch flag does not work with a lib project #11100

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
zbarbuto opened this issue Jun 4, 2018 · 15 comments · Fixed by #11358
Closed

Build with --watch flag does not work with a lib project #11100

zbarbuto opened this issue Jun 4, 2018 · 15 comments · Fixed by #11358
Labels

Comments

@zbarbuto
Copy link

zbarbuto commented Jun 4, 2018

Versions

Angular CLI: 6.0.7
Node: 9.6.1
OS: darwin x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.5
@angular-devkit/build-angular      0.6.5
@angular-devkit/build-ng-packagr   0.6.5
@angular-devkit/build-optimizer    0.6.5
@angular-devkit/core               0.6.5
@angular-devkit/schematics         0.6.5
@angular/cdk                       6.1.0
@angular/cli                       6.0.7
@angular/material                  6.1.0
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.5
@schematics/angular                0.6.5
@schematics/update                 0.6.7
ng-packagr                         3.0.0
rxjs                               6.2.0
typescript                         2.7.2
webpack                            4.8.3

Observed behavior

Running ng build --watch works perfectly fine on the default app in a monorepo with the default app.

However, running ng build mylib --watch or ng build --watch mylib after generating a lib with the CLI gives Unknown option: '--watch'

Desired behavior

Can build any of the apps or libs in an Angular cli monorepo in --watch mode.

Mention any other details that might be useful (optional)

Have tried various combinations of ordering the arguments as well as --watch=true and -w. None seem to work.

@elclanrs
Copy link

elclanrs commented Jun 4, 2018

This is not supported yet. I'm eagerly awaiting for this PR to be merged in ng-packagr.

@gabrielalan
Copy link

gabrielalan commented Jun 11, 2018

So they launch a new major version of the CLI breaking one of the commands? 😂

@jrista
Copy link

jrista commented Jul 25, 2018

Any idea on when this might be available? We are doing a lot of work with libs at the moment, no ability to watch is really rough...

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jul 25, 2018 via email

hansl pushed a commit that referenced this issue Jul 30, 2018
…brary

`ng-packagr` version `4.0.0-rc.3`, lands the incremental builds feature.

More info:  https://github.com/dherges/ng-packagr/blob/master/CHANGELOG.md#400-rc2-2018-06-23

`enableResourceInlining` needs to be enabled for libraries that contain components

Closes: #11100
@bezysoftware
Copy link

I installed the latest 6.2.0 beta.0, but am still unable to do ng build --watch for a library ("unknown switch"). Here's outcome of ng --version:

Angular CLI: 6.2.0-beta.0
Node: 8.11.3
OS: win32 x64
Angular: 6.1.0
... common, compiler, compiler-cli, core, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.7.2
@angular-devkit/build-angular      0.7.2
@angular-devkit/build-ng-packagr   0.7.2
@angular-devkit/build-optimizer    0.7.2
@angular-devkit/build-webpack      0.7.2
@angular-devkit/core               0.7.2
@angular-devkit/schematics         0.8.0-beta.0 (cli-only)
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.1.2
@schematics/angular                0.8.0-beta.0 (cli-only)
@schematics/update                 0.8.0-beta.0 (cli-only)
ng-packagr                         4.0.1
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.9.2

Whats should I do?

@alan-agius4
Copy link
Collaborator

@bezysoftware you need to update all @angular-devkit/<packages> to 0.8.0-beta.0

@bezysoftware
Copy link

Thanks, that worked. Now first time compilation works, but the diff compilation fails:

File change detected. Starting incremental compilation...

BUILD ERROR
no elements in sequence
EmptyError: no elements in sequence
    at new EmptyError (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\util\EmptyError.js:16:28)
    at C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\operators\last.js:11:294
    at Object.complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\operators\throwIfEmpty.js:12:23)
    at TapSubscriber._complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\operators\tap.js:76:31)
    at TapSubscriber.Subscriber.complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\Subscriber.js:76:18)
    at TakeLastSubscriber._complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\operators\takeLast.js:71:21)
    at TakeLastSubscriber.Subscriber.complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\Subscriber.js:76:18)
    at MergeMapSubscriber._complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\operators\mergeMap.js:80:30)
    at MergeMapSubscriber.Subscriber.complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\Subscriber.js:76:18)
    at FilterSubscriber.Subscriber._complete (C:\Users\**\projects\Nexus\WidgetMessaging\node_modules\rxjs\internal\Subscriber.js:94:26)


Compilation failed. Watching for file changes...

I guess tha'ts worth a separate issue

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Aug 2, 2018 via email

@xino1010
Copy link

xino1010 commented Aug 3, 2018

Hi @bezysoftware @alan-agius4 !
How can I install the latest 6.2.0 beta.{0,1}?
Thanks

@alan-agius4
Copy link
Collaborator

You can use

ng update @angular/cli --next

@GeorgeKnap
Copy link

Watch mode works for these versions :)
@angular-devkit at 0.8.0-rc.0
@angular at 6.1.4
ng-packagr at 4.1.0

sweet!

@KoBe321
Copy link

KoBe321 commented Sep 13, 2018

It's working for me with:

@angular-devkit/build-angular": "^0.8.1
@angular-devkit/build-ng-packagr": "^0.8.1
@angular/cli": "^6.2.1
ng-packagr": "^4.1.1

However, if I make any changes in the lib, it reloads the page twice.

@arm1n
Copy link

arm1n commented Sep 17, 2018

Although it's working for --watch now, it seems that no one of the other flags are working though, f.e. --output-path or --delete-output-path when using with a library. Im using Angular CLI 6.2.2. Can anyone else confirm this?

@drizzt74
Copy link

drizzt74 commented Nov 6, 2018

@arm1n I can confirm it for Angular CLI 7.0.4. Althought I didn't extensively check, it seems the only working flags are those few reported by the ng build --help command, not those described in documentation page: https://angular.io/cli/build
NOTE: I'm referring to a lib project

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.