Skip to content
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

Unable to debug with webpack enabled #213

Closed
joshcomley opened this issue Oct 6, 2018 · 2 comments · Fixed by #214
Closed

Unable to debug with webpack enabled #213

joshcomley opened this issue Oct 6, 2018 · 2 comments · Fixed by #214

Comments

@joshcomley
Copy link
Contributor

On a brand new fresh project generated from a brand new install of SideKick (using the Angular tabbed template), if I add the appropriate "tnsArgs":["--bundle"] into launch.json then and run "Launch on Android", VS Code fails to hit any breakpoints, and breakpoints are greyed out, marked as an "Unverified breakpoint".

I can confirm my web.config.js is unchanged from the template, including having the correct devtool: sourceMap ? "inline-source-map" : "none".

If I put debugger; in my code and run, it is hit, but in a separate window to the original source code.

My set up:
Windows - 10
NativeScript - 4.2.4
VS Code - 1.27.2
nativescript-dev-webpack - 0.16.0

Is there anything I can try to get them working? As I understand, debugging webpacked NS in VS Code is supported (according to: https://docs.nativescript.org/tooling/visual-studio-code-extension#debug-webpack).

Many thanks

@joshcomley
Copy link
Contributor Author

joshcomley commented Oct 7, 2018

The answer to this lies in the mismatch between the documentation for how to debug webpack and the starter template.

launch.json should be edited as follows:

{
    "name": "Launch on Android",
    "type": "nativescript",
    "request": "launch",
    "platform": "android",
    "appRoot": "${workspaceRoot}",
    "sourceMaps": true,
    "watch": true,
    "sourceMapPathOverrides": {
        "webpack:///*": "${workspaceRoot}/src/*"
    },
    "tnsArgs": ["--bundle"]
},

Specifically pertaining above to the sourceMapPathOverrides section; the root application code folder in the templates generated by SideKick (at least the one I used) is src, not app, so "webpack:///*": "${workspaceRoot}/src/*" is needed instead of "webpack:///*": "${workspaceRoot}/app/*".

@sis0k0
Copy link
Contributor

sis0k0 commented Oct 8, 2018

Good catch! Thank you!

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