nativescript-community / nativescript-vscode-extension

A Visual Studio Code Extension for NativeScript
https://www.nativescript.org/visual-studio-code
Apache License 2.0
82 stars 32 forks source link

Hot Module Replacement (--hmr) does not work in VSCode #221

Closed davidovich closed 5 years ago

davidovich commented 5 years ago

Environment

Using nativescript-vue and vue-loader

Describe the bug When using --hmr in the debugger launch options, hmr is activated (I see recompilation and bundle transfered to device messages), the application starts and works, but code changes still trigger an app reload.

To Reproduce use the "tnsArgs": [ "--hmr" ] option in Launch.json, and Launch on iOS. Make a code change.

Expected behavior The app is not restarted, and the code change is reflected in the app.

Additional context The latest vue-cli-template has an older vue-loader which has vue-hot-reload-api pinned at 2.3.0, and contains a window reference bug (which shows only when using --hmr). You need to update to "vue-loader": "^15.4.2" and update dependencies to get vue-hot-reload-api at 2.3.1

davidovich commented 5 years ago

Additional note: If you use tns run ios --hmr from a console, it works as expected. So it seems to be the tns debug command, which is used by the vscode extension that triggers the reload: `[NativeScriptCli] execute: tns --analyticsClient VSCode debug ios --watch --hmr'.

Is it possible to debug an hmr build started with tns run ?

Fatme commented 5 years ago

@davidovich,

Currently debug command does not support --hmr mode but we're working on implementing it. You can track the progress of the feature in this thread https://github.com/NativeScript/nativescript-cli/issues/2992.

davidovich commented 5 years ago

Wow that is awesome! Thanks!

rosen-vladimirov commented 5 years ago

Acceptance criteria: