Running `ng build --watch` not always picking up some code changes
See original GitHub issueWhen running ng build
with --watch
, which we do pretty regularly as we have either nodemon or pm2 running a node server that hosts our site as well as API, background workers, our whole server backend basically, we often find that many code changes are not properly detected by ng build and it will report unchanged chunks, rather than properly rebuilding those that have actually had changes to the code.
We have observed that if a template is then changed in the same chunk, that usually results in the build properly rebuilding that chunk. Sometimes total removal of code from a file, to force an error, then restoration of it, will force proper rebuilding of a chunk.
Versions
→ ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.6.7
Node: 8.9.4
OS: darwin x64
Angular: 4.4.6
... common, compiler, compiler-cli, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router, tsc-wrapped
@angular/cli: 1.6.7
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.7
@schematics/angular: 0.1.17
typescript: 2.3.4
webpack: 3.10.0
Repro steps
- Step 1: Make a code change to a model, service, NGRX state, etc.
- Step 2: Save the changed file(s).
- Step 3: Make a change to a template.
- Step 4: Save the template.
Observed behavior
9 unchanged chunks
chunk {clients.module} clients.module.chunk.js, clients.module.chunk.js.map () 351 kB [rendered]
Date: 2018-02-08T22:36:07.995Z - Hash: 72e9dc9abbe1980916c8 - Time: 1463ms
10 unchanged chunks
Date: 2018-02-08T22:36:20.720Z - Hash: a9b0f4039ddc2b83dcb6 - Time: 982ms
10 unchanged chunks
Date: 2018-02-08T22:36:23.728Z - Hash: 72e9dc9abbe1980916c8 - Time: 863ms
10 unchanged chunks
Date: 2018-02-08T22:36:40.084Z - Hash: 31ddf5af1f9d07a7c892 - Time: 1113ms
9 unchanged chunks
chunk {clients.module} clients.module.chunk.js, clients.module.chunk.js.map () 351 kB [rendered]
Desired behavior
I would expect ng build to properly account for all changes made, to both code and templates, and the proper rebuilding of affected chunks.
Mention any other details that might be useful (optional)
This behavior is inconsistent, it does not always happen. It seems I encounter it most often with changes to models, properties in components, etc. This often leads to confusion when testing in the UI, and recent changes are not being applied. I have not been able to identify a specific scenario where it always occurs. Sometimes it seems like the code change may not actually matter, and the lack of rebuilding is immaterial…however upon testing again in the browser, the old issues remain, indicating the code change does indeed matter.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:11 (1 by maintainers)
Just an update. Been having trouble reproducing the issue. I am not sure if it is due to our use of a fair number of lazy loaded modules or not. Once I am able to reproduce the issue I’ll share how.
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.