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.

Angular Build --watch caches initial version of files in a symlinked folder. Subsequent changes are not reflected until full rebuild

See original GitHub issue

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

Angular 12

Description

Hi Team,

We are having issues with Angular not loading changes of symlinked files. It appears to build the first time and cache the output. Changing the file shows Angular rebuilding but it uses the old version. You have to kill ng build and start again.

Our project is in single Git repository. It consists of an Angular 14 front end and a Node backed API using NestJS. We also have model folder that contains shared DTO’s and utilities.

The simplified folder structure is as follows -

/
 angularapp
    libs/
       model (symlink of /model)
 nodeapp
    libs/
       model (symlink of /model)
 model

We have been using the structure since Angular 2 and I believe it worked up until you switch to WebPack 5.

Minimal Reproduction

  1. Create an Angular Project
  2. Create a folder outside the project called model
  3. Symlink the folder inside the Angular project eg - /angularapp/model
  4. Add files to the model folder.
  5. Do a build in watch mode
  6. Change the contents of a file in the model folder
  7. Wait for watcher to finish build
  8. Refresh the browser and the change will not be visible
  9. Cancel the watch build
  10. Build again
  11. Refresh the browser and the change will be visible.

Exception or Error

No response

Your Environment

Angular CLI: 14.2.1
Node: 16.15.1
Package Manager: npm 8.11.0 
OS: darwin arm64

Angular: 14.2.0
... animations, cdk, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.1
@angular-devkit/build-angular   14.2.1
@angular-devkit/core            14.2.1
@angular-devkit/schematics      14.2.1
@angular/cli                    14.2.1
@schematics/angular             14.2.1
rxjs                            7.5.5
typescript                      4.6.2

Anything else relevant?

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:15

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Sep 12, 2022

You can patch the node_modules until it has been fixed and released.

1reaction
thaoulacommented, Sep 12, 2022

Hash works fine in combination with the watchOptions.followSymlinks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Watching symlinks doesn't work in dev mode · Issue #15100
Angular Build --watch caches initial version of files in a symlinked folder. Subsequent changes are not reflected until full rebuild ...
Read more >
Angular build watch for multiple libraries and and serve to ...
But the problem is when a libary is rebuilt, It first erase the linked files in dist folder (which linked by npm locally)...
Read more >
ng build does not detect changes? : r/angular
After saving the files in VS Code, I run "ng build", but when I go to the website, it does not show the...
Read more >
Changelog | Meteor API Docs
Improved tracking of which files are used by build plugins to know when it should do a full rebuild, a faster client-only rebuild,...
Read more >
HTTP - Developers - Dropbox
The Dropbox API allows developers to work with files in Dropbox, including advanced functionality like full-text search, thumbnails, and sharing.
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