ng serve doesn't re-render files most of the time
OS?
Windows 10
Versions.
@angular/cli: 1.0.0-rc.0 node: 7.5.0 os: win32 x64 @angular/common: 2.4.8 @angular/compiler: 2.4.8 @angular/core: 2.4.8 @angular/forms: 2.4.8 @angular/http: 2.4.8 @angular/platform-browser: 2.4.8 @angular/platform-browser-dynamic: 2.4.8 @angular/router: 3.4.8 @angular/cli: 1.0.0-rc.0 @angular/compiler-cli: 2.4.8
Repro steps.
Happens all the time since update from beta version
Since I updated, ng serve doesn't rerender the file.
It sees the files that have changed and launches a recompilation but the changes don't get included.
It doesn't do this for a couple of recompilations then it refuses to update the files.
What kind of details can I give you?
Thanks
@ovalol I tried following your steps exactly as you posted, looking at the changes in the browser, and I could always see the correct output (first app works, then bar works, then nothing, then foo-bar). I didn't need to restart the server to see changes.
@mp-tbianchi I tried your changes as well, and could see 4 printed in the console log.
@mfreirehfexp I haven't seen that behaviour yet but will keep an eye out for it.
I noticed that you three are using Windows (7 and 10). I am using Windows as well and can't see this... maybe there's something else at play.
Are you using a symlink or a juntion on your project path? Is there anything else odd you've seen? Do you get vendor.bundle.js on builds?
@filipesilva I don't have any symlink or junctions in the path.
I've had the bug on "old" projects that have been updated to the latest angular/cli and also new projects (in the example above). Both projects are in separate folders.
For vendor.bundle.js, do you mean if the file is generated? In that case, yes it is.
@filipesilva I m not using symlink or anything else. Everything works fine with the previous version[email protected].
And vendor.bundle.js is correctly generated.
Oh, I just noticed something very weird.
What IDE/Editor do you all use?
When I use webstorm to modify the file : if I save with CTRL+S, sometimes the change is seen, sometimes not (I track this by checking if [rendered] is present on the main.bundle.js line).
If I use Webstorm's auto save by navigating to my console (Conemu) without CTRL+S, the change is seen less often.
But if I modify the file with Notepad++ and save with CTRL+S, the [rendered] appears everytime.
@mp-tbianchi I also use Webstorm haven't try with Notepad, I will in a few moments @filipesilva I'll copy the state on the next ocurrence
I use webstorm to.
I disable Use "safe write" option and everything seems ok.
https://webpack.github.io/docs/troubleshooting.html#file-saves-in-webstorm-don-t-trigger-the-watcher
huh... The more you know.... But it's weird I didn't have this problem before
@ovalol @mp-tbianchi I'm trying with that So far it seems to work I'll continue along the day and tell you how it works
Hm... I know there's a problem with junctions in windows (#3797) so I thought that might be it.
Speaking of webstorm, I know there was a change we made regarding file changes in the past (#4542) for similar reasons.
So it seems that the culprit is some weird interaction between webstorm and webpack? Jeez... I didn't know that happened. Good job finding it!
I don't have a better solution than disabling safe write either. But let me know if that fixes it for you over the next few days.
Hi I've been working a couple of hours and the number of errors is greatly reduced. But I still find the necessity of kill the server and start again I'll look if I find a patron and tell you Thanks!
After a couple of days of testing, can't say I've seen any errors since I disabled safe write.
That's very good to hear! I know it sucks to have to disable safe write though, so I'm leaving this issue open to see if we can find a way that isn't necessary.
I also added it to FAQs so other people can find it.
Thanks to all that helped test this and came up with solutions, you guys rock!
I had this issue on NVIM/VIM, not using Webstorm.
i have exactly the same issue on Win 10, with IntelliJ IDEA and rc0-rc4. an "old" cli beta-version works perfectly. deactivating "safe write" fixed it for me.
@instantepiphany vim has probably a similar "safe write" behavior
I had the same problem until I stopped using --aot=true and now anytime I save a file the changes are picked up properly.
What is aot doing that would cause the changes not to be picked up?
Guys, I am using Visual Studio Code and getting same problem, I couldn't find 'safe write' thing in my IDE.
Hi @jamilalisgandarov The 'safe-write' option is a Webstorm config, I don't know if VisualStudio has such an option
@instantepiphany, with VIM you can use the solution from here:
:set backupcopy=yes
@hpawe01 This seems to fix the issue for me, thanks so much for the link!
Are there two different mechanisms being used to detect the changes? When I save in VIM (without the backupcopy setting) ng serve recompiles, but whatever does the recompiling is not picking up the actual change...