Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
Whenever you type to change the code even if you press the spacebar, HMR is fired and the app is restarted.
To Reproduce
tns run android
Expected behavior
HMR is fired only after you save the changes and the app should not restart.
Sample project
-none
Additional context
-none
@leocrawf - I ran into something like this but it was VSCode actually saving the file every 100ms, there is an automatic save setting in VSCode, so be sure to disable that or bump it to a really high value. That solved it for me recently.
Hello @bradmartin, thank you for the quick response. I turned off the AutoSave on VScode and I still have the issue. I then decided to just use a plain text editor then I realized the issue was not occurring anymore, so the autosave is a visual studio issue. However, the app still restarts if I save the changes on the UI. This was not an issue in 6.x
@leocrawf what flavor is this? Angular, Vue, core?
I am using Nativescript core with plain JavaScript.
I am having the same issue, on NS Vue, CLI 7.0.11.. What's funny, it was working in one of my freshly created app, not sure what happened, then it stopped working again. Very unstable HMR is. Excited to have a full HMR I am.
@rigor789 I can confirm hmr is done in 7.x it will always trigger an app restart. For me on both iOS and android in vue apps. Not tried other flavors
This is an issue in CopyWebpackPlugin - I debugged this a few weeks ago, but forgot about this issue to update it.
https://github.com/webpack-contrib/copy-webpack-plugin/issues/504
And @shirakaba added even more details here: https://github.com/shirakaba/react-nativescript/issues/65
So is there a fix coming down the pipeline @rigor789 ?? We all love the NativeScript tool, but having the app restart on just a simple css change is not the best experience which I am sure you know. :)
@mykone absolutely agree, but no ETA at this time
@rigor789 do you know of any workaround to get HMR working?
After applying the @shirakaba workaround in NSVue we figure out another problem, If you are looking how to solve this issue for a NSVue project, check this out nativescript-vue#747