Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidovich opened this issue Nov 7, 2018 · 4 comments
Closed

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

davidovich opened this issue Nov 7, 2018 · 4 comments
Assignees
Labels

Comments

@davidovich
Copy link

Environment

  • CLI: 5.0.0.
  • Cross-platform modules:
  • Android Runtime: N/A
  • iOS Runtime: 5.0.0
  • Plugin(s):
  • VSCode: 1.28.2

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
Copy link
Author

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
Copy link
Contributor

Fatme commented Nov 8, 2018

@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 NativeScript/nativescript-cli#2992.

@davidovich
Copy link
Author

Wow that is awesome! Thanks!

@rosen-vladimirov rosen-vladimirov self-assigned this Mar 13, 2019
@rosen-vladimirov rosen-vladimirov changed the title Hot Module Replacement (--hmr) reloads app on device Hot Module Replacement (--hmr) does not work in VSCode Mar 13, 2019
@rosen-vladimirov
Copy link
Contributor

Acceptance criteria:

  • Should work with Angular NativeScript projects
  • Should work with Pure JavaScript NativeScript projects
  • Should work with Pure TypeScript NativeScript projects
  • Should work with Vue NativeScript projects
  • Should work when enabled with adding "tnsArgs": [ "--hmr" ] in launch.json
  • Should work when enabled with setting "useLegacyWorkflow": false in nsconfig.json
  • When a breakpoint is placed in a file, debugger must stop exactly on this line.
  • When passing "tnsArgs": [ "--hmr", "--debug-brk" ], --debug-brk should force restart of application on each change (disregard hmr flag).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants