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

Debugging not working with new angular projects and --bundle #232

Closed endarova closed 5 years ago

endarova commented 5 years ago

Environment CLI: @rc(5.1.1) Cross-platform modules: 5.1.1 Android Runtime: 5.1.0 iOS Runtime: 5.1.0 VSCodeExtension: v.2018.12.11.1

To Reproduce: tns create newApp --ng cd newApp code . Add "tnsArgs": ["--bundle"] in the Launch on Android task. Run the Launch on Android task. Set a breakpoint. The breakpoint is grayed out and marked as unverified

It is the same for ios. (It is working with old templates for example @5.1.0).

Expected behavior You should be able to debug the NativeScript apps in VSCode when the --bundle flag is passed.

18clans commented 5 years ago

Same issue with me.

AhmedAzzabi commented 5 years ago

Yes same here, the debug and hmr functinoality were fixed, in chrome debug it works fine, but the breakpoints are not working when --bundle or --hmr option are passed, and it is not ideal to switch between editor and chrome for debug.

rosen-vladimirov commented 5 years ago

We've investigated this issue and it seems to happen only for Angular projects. The problem is caused by the "nativescript-dev-webpack/lazy-ngmodule-hot-loader", so in case you are not using HMR, you can safely comment the line where "nativescript-dev-webpack/lazy-ngmodule-hot-loader", is used from your webpack.config.js. We are looking for a solution, but meanwhile you can use the above mentioned workaround.

theunsa commented 5 years ago

@rosen-vladimirov

... it seems to happen only for Angular projects

While a PR on this has been merged and is probably being tested, I wanted to point out that I get the same problem for a nativescript-vue app i.e. tns create newApp --vue with platform ios. Would appreciate it if the tests verified the Vue use case as well. Thanks!

Environment

endarova commented 5 years ago

Hi @theunsa, Thank you for reporting the issue. We have pull request in the nativescript-dev-webpack repo that is fixing this behavior. #https://github.com/NativeScript/nativescript-dev-webpack/pull/774/files. When it is merged and released you will have to update your project's nativescript-dev-webpack plugin. Meanwhile you can try applying the same changes as in the PR to your webpack.config.js file.