Skip to content

Breakpoints at the startup of a program that is executed via NPM aren't being triggered #1704

Closed
@gfszr

Description

Describe the bug
When running a simple Typescript script via a NPM task, breakpoints do not jump at the beginning of the execution. To emphasize this even more, I wrote a very small program that exists pretty quickly, and in it no breakpoint is jumped at all.

I suspect that, because js-debug attaches to child processes via NODE_OPTIONS injecting of a debugger script, that the script executes too quick for the debugger to actually place the breakpoints.

To Reproduce
The following app.ts code:

let i = 0
function main() {
    console.log("hello world")
}
main()

With the following run configuration:

{
    "name": "Example",
    "request": "launch",
    "runtimeArgs": [
        "run-script",
        "start"
    ],
    "runtimeExecutable": "npm",
    "outFiles": [
        "${workspaceFolder}/out/**/*.js"
    ],
    "type": "node",
    "console": "integratedTerminal",
},

And from package.json:

  "scripts": {
    "start": "node ./out/app.js",
    "build": "npx tsc -p ."
  },

VS Code Version: VSCode 1.78.1, Plugin: v1.78.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions