Skip to content

ng build --watch does not work after adding a lib to the workspace #23291

Closed
@rothsandro

Description

@rothsandro

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 13.3.7

Description

When creating an empty workspace and adding an application, the ng build --watch command works as expected. After adding a library to the workspace it does not work anymore. Running the command will throw the following error:

Error: Unknown argument: watch

🔬 Minimal Reproduction

  1. ng new watchdemo --create-application=false
  2. cd watchdemo
  3. ng generate app showcase
  4. Add --project=showcase to the build + watch scripts in package.json
  5. npm run build and npm run watch => works
  6. ng generate lib comp
  7. npm run build => works (builds the showcase app)
  8. npm run watch => Error: Unknown argument: watch

Repo Angular 14: https://github.com/rothsandro/repro-ng-cli-watch-14/
Repo Angular 13 (works): https://github.com/rothsandro/repro-ng-cli-watch-13/

🔥 Exception or Error

Error: Unknown argument: watch

🌍 Your Environment


Angular CLI: 14.0.0
Node: 16.13.0
Package Manager: npm 8.1.0 
OS: darwin arm64

Angular: 14.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.0
@angular-devkit/build-angular   14.0.0
@angular-devkit/core            14.0.0
@angular-devkit/schematics      14.0.0
@schematics/angular             14.0.0
ng-packagr                      14.0.0
rxjs                            7.5.5
typescript                      4.7.3

Anything else relevant?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions