Environment
Describe the bug
When saving any file with vue class component style + typescript, It simply does not update. Give me the following error:
File change detected. Starting incremental webpack compilation...
Successfully transferred bundle.609c813aedb0d81fb57e.hot-update.js on device emulator-5554.
Successfully transferred 609c813aedb0d81fb57e.hot-update.json on device emulator-5554.
JS: HMR: Checking for updates to the bundle with hmr hash 609c813aedb0d81fb57e.
JS: HMR: Ignored an update to unaccepted module:
JS: HMR: ➭ ./routes.ts
JS: HMR: ➭ ./main.ts
JS: HMR: Cannot apply update with hmr hash 609c813aedb0d81fb57e.
JS: HMR: Aborted because ./routes.ts is not accepted
JS: Update propagation: ./routes.ts -> ./main.ts
Refreshing application on device emulator-5554...
Successfully transferred bundle.js on device emulator-5554.
Successfully transferred runtime.js on device emulator-5554.
Successfully transferred vendor.js on device emulator-5554.
JS: HMR: Cannot apply update. A previous update aborted. Application needs to be restarted in order to apply the changes.
Restarting application on device emulator-5554...
This causes the entire application to restart, with no HRM update.
To Reproduce
Base on nativescript blogs NativeScript-Vue with Class Components More samples on the link.
Next: Create the following template:
<Label text="Hello" textWrap="true" />
Then add a hello to the text
<Label text="Hello Hello" textWrap="true" />
Check the error.
Expected behavior
Use the famous HMR without restarting the entire App. I consider this a severe problem or bug, since it slows down your productivity as developer while waiting to the app to restart.
tns debug android --no-hmr
In nativescript-vue and HMR is not guarantied. HMR can be used only while making changes in style files.
I use tns debug android
only for styling. If I make any other change I do not trust HMR.
I have added a yarn script called yarn devan
to speed up typing process.
I have added following lines to my package.json file
{
"scripts": {
"dev": "tns debug android",
"devan": "tns debug android --no-hmr",
"devin": "tns debug ios --no-hmr",
"un": "adb uninstall com.domain.yourapp"
},
}
You will always see HMR error message if you use typescipt files in nativescript-vue projects.
JS: HMR: Checking for updates to the bundle with hmr hash 7d5f6392d6103f1496e6.
JS: WARN HMR: Ignored an update to unaccepted module:
JS: WARN HMR: ➭ ./routes/index.ts
JS: WARN HMR: ➭ ./main.ts
JS: ERROR HMR: Cannot apply update with hmr hash 7d5f6392d6103f1496e6.
JS: ERROR HMR: Aborted because ./routes/index.ts is not accepted
JS: Update propagation: ./routes/index.ts -> ./main.ts