Sahas
Sahas

Reputation: 3186

VSCode debugging es6 node.js code doesn't catch breakpoint

Setup:

Mac: 10.12.1

VsCode:1.8.1

Launch.json is below

        {
        "name": "Launch",
        "type": "node",
        "request": "launch",
        "program": "${workspaceRoot}/node_modules/.bin/babel-node",
        "stopOnEntry": false,
        "args": ["${workspaceRoot}/src/bin/www.js"],
        "cwd": "${workspaceRoot}",
        "preLaunchTask": "build",
        "runtimeExecutable": null,
        "runtimeArgs": [
            "--nolazy"
        ],
        "env": {
            "NODE_ENV": "development"
        },
        "console": "internalConsole",
        "sourceMaps": true,
        "outFiles": [
            "${workspaceRoot}/dist"
        ]
    }

Tasks.json is below

{
"version": "0.1.0",
"command": "npm",
"isShellCommand": true,
"showOutput": "always",
"suppressTaskName": true,
"tasks": [
    {
        "taskName": "build",
        "args": ["run","build"],
        "isBuildCommand": true
    }
   ]
}

When I start the debugger, session gets started with below output

node --debug-brk=10048 --nolazy node_modules/.bin/babel-node .../src/bin/www.js

Debugger listening on port 10048

Everything looks good but I can never catch a breakpoint.. I must be missing something silly, appreciate any help.

Thanks !!

Upvotes: 0

Views: 165

Answers (2)

Ali K. Bagcioglu
Ali K. Bagcioglu

Reputation: 1732

if you use typescript, you should add sourceMap setting in tsconfig.json file

tsconfig file is a configuration file for transforming from typescript to javascript

Upvotes: 0

yashodhan divakaran
yashodhan divakaran

Reputation: 291

For future reference if anyone need to know the solution.

"outFiles": [
            "${workspaceRoot}/dist/*.js"
        ]

Upvotes: 0

Related Questions