You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to get HMR working in Vue with TypeScript #9507
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):
CLI: 8.0.2
Cross-platform modules:
Android Runtime: ^8.0.0
iOS Runtime: ^8.0.0
XCode Version: 12.5.1
Plugin(s):
Describe the bug
Trying to get a HMR working with TypeScript and Vue
To Reproduce
ns create --vue --ts ns-vue-app
# I also tested with ns create --vue ns-vue-app no typescript and get similar results
cd ns-vue-app
ns run ios
# app is now in simulator
# modify app/components/Home.vue so the message is changed
#save
Expected behavior
The modified message appears in the simulator
Sample project
Additional context
Running on macOS and Simulator is running iPad Air simulator
ns debug ios sort of works but it does a "restart" it does not update the running app. Or is that by design? Also it only reloads ONCE. Doing another change to the string and saving does not restart it. If I restart the app it allows for one restart.
HMR does work. All you need to do is to navigate to another screen then go back to the screen you just modified because the hot reload those not update a screen in place until it's rerendered and you don't necessarily need to restart the app.
Yes with the current implementation - I'm working on improvements for Page HMR (other components that don't trigger a page to be re-rendered work fine).
no-hmr works, but having to wait ~5-10 seconds to then navigate to the page that's being edited, unfortunately is frustrating developer experience. (I know the page can be set as start page, so the navigation part can be skipped. but still..) I soo wish there was a solution to be able to quickly style pages with NativeScript Vue.
I can imagine HMR being super complicated to get right, but it would be such a big win for Nativescript (Vue)
@trajano wish it was a trivial fix, though i do have a branch that is almost working, just need to revive it when i get the chance... Biggest pain point with it is preserving the navigation stack during refreshes.
HMR for Vue is supported in nativescript-vue 3, and with @nativescript/vite as well. Please open an issue at https://github.com/nativescript-vue/nativescript-vue if HMR doesn't apply changes with a current setup.
Activity
trajano commentedon Aug 10, 2021
trajano commentedon Aug 10, 2021
Code that I changed
trajano commentedon Aug 10, 2021
ns debug iossort of works but it does a "restart" it does not update the running app. Or is that by design? Also it only reloads ONCE. Doing another change to the string and saving does not restart it. If I restart the app it allows for one restart.trajano commentedon Aug 10, 2021
Digging further I found this nativescript-vue/nativescript-vue#846 and nativescript-vue/nativescript-vue#747 and nativescript-vue/nativescript-vue#518 so it may likely be something specific to NativeScript-Vue
heywhy commentedon Aug 24, 2021
HMR does work. All you need to do is to navigate to another screen then go back to the screen you just modified because the hot reload those not update a screen in place until it's rerendered and you don't necessarily need to restart the app.
trajano commentedon Aug 24, 2021
Is that a limitation of Vue's HMR implementation?
rigor789 commentedon Aug 24, 2021
Yes with the current implementation - I'm working on improvements for Page HMR (other components that don't trigger a page to be re-rendered work fine).
This PR is part of the effort: #9460
trajano commentedon Aug 24, 2021
@rigor789 your statement makes it sound like the issue is with NativeScript's implementation rather than VueJS' implementation.
rigor789 commentedon Aug 24, 2021
Requires changes in both NativeScript (the above PR) and nativescript-vue - the latter being much less trivial to fix.
trajano commentedon Aug 24, 2021
@rigor789 so nothing needed from VueJS team then, that's good.
AbrahamBrookes commentedon Apr 7, 2022
I had the same problem and the solution was to run nativescript with the
--no-hmrflag - this skips the hmr entirely and just reboots the app on code change (found via https://stackoverflow.com/questions/59180667/nativescript-vue-not-live-updating)tns run android --no-hmrMrSnoozles commentedon Aug 21, 2022
no-hmrworks, but having to wait ~5-10 seconds to then navigate to the page that's being edited, unfortunately is frustrating developer experience. (I know the page can be set as start page, so the navigation part can be skipped. but still..) I soo wish there was a solution to be able to quickly style pages with NativeScript Vue.I can imagine HMR being super complicated to get right, but it would be such a big win for Nativescript (Vue)
trajano commentedon Aug 26, 2022
@rigor789 the PR you specified #9460 seems to be merged now. Is the trivial fix ready?
rigor789 commentedon Aug 26, 2022
@trajano wish it was a trivial fix, though i do have a branch that is almost working, just need to revive it when i get the chance... Biggest pain point with it is preserving the navigation stack during refreshes.
tommag21 commentedon Oct 4, 2023
any update on this?
rigor789 commentedon Oct 4, 2023
https://twitter.com/igor_randj/status/1599830172143788032
tommag21 commentedon Oct 4, 2023
Thank you, it seems I have a lot to catch up on. First I need to migrate my apps to Nativescript-Vue 3, are there any docs?
NathanWalker commentedon Oct 23, 2026
HMR for Vue is supported in nativescript-vue 3, and with
@nativescript/viteas well. Please open an issue at https://github.com/nativescript-vue/nativescript-vue if HMR doesn't apply changes with a current setup.