question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Watch Dependencies and rebuild

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

The “ng build --watch” is not rebuilding when a dependency is rebuilt (another angular library).

We have a setup in which we have 2 libraries (Shared and Product) and 1 Angular project.

Shared library is used by both Angular and Product Library. It is shared from local dist.

package.json of library:
{
  "name": "product-lib",
  "version": "0.0.1",
  "peerDependencies": {
    "@angular/common": "^8.1.3",
    "@angular/core": "^8.1.3"
  },
  "dependencies": {
     "shared-lib":"file:../shared-proj/dist/shared-lib"
  }
}

package.json of Angular Project:
{
  "dependencies": {
     "shared-lib":"file:../shared-proj/dist/shared-lib"
  }
}

We try to do simultaneous development among the 3.

  1. ng build --watch (shared-lib)
  2. ng build --watch (product-lib)
  3. ng serve (Angular)

On any change in the shared-lib the watch is initiated and the library is built. Angular realizes that the library got rebuilt and it rebuilds itself with the library changes. But product-lib is not able to detect the changes in its dependencies.

To make this work we have to stop the watch, “npm install” again and then start the watch.

How To Reproduce

Explained Above.

Expected Behaviour

The watch should also detect changes in dependencies and reinstall dep & rebuild itself similar to how Angular does it.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 10.0.4
@angular/compiler: 8.2.14
rollup:  2.24.0
tsickle:  0.35.0
typescript:  3.4.5
node: 12.7.0
npm: 6.10.0

If this is already supported please let me know how to.

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MickLcommented, May 26, 2021

So for Angular 11 it was working: When I changed my symlinked library the main app did rebuild correctly. Now with Angular 12 the main app rebuilds but changes are not applied. I tried partial enableIvy: true/false and compilationMode: “partial”

So with Angular 12 I always have to restart my app which is “kind of” annoying.

@alan-agius4 Maybe you have an idea why the behavior changed with Angular 12?

0reactions
github-actions[bot]commented, Nov 19, 2021

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically rebuild dependencies when watching library
I have created a non-application Angular 12 project, which consists of multiple libraries - the project acts as a base configuration that is ......
Read more >
Rebuild code automatically with "watch" and a makefile
The idea is to pair it with make to run tests and automatically rebuild/recompile code. Since make tracks dependencies and looks at file ......
Read more >
Watch and WatchOptions | webpack
You will need to ignore files and/or directories so that unwanted changes will not trigger a rebuild. watchOptions.poll. boolean = false number. Turn...
Read more >
npm-watch
Start using npm-watch in your project by running `npm i npm-watch`. There are 168 other projects in the npm registry using npm-watch.
Read more >
watch changes on files an rebuild automatically - Google Groups
> consider great alternatives personally. Well, what's better? Adding code and dependencies to Pandoc for every major platform and also trying to supply ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found