Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Last active April 30, 2024 16:35
Show Gist options
  • Save cecilemuller/2963155d0f249c1544289b78a1cdd695 to your computer and use it in GitHub Desktop.
Save cecilemuller/2963155d0f249c1544289b78a1cdd695 to your computer and use it in GitHub Desktop.
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
"args": ["src/script.ts", "--example", "hello"],
"cwd": "${workspaceRoot}",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
@Davetwo
Copy link

Davetwo commented Mar 8, 2024

Thanks!
General purpose ts-node run opened file (using ${file}) whereas process-library is the base-folder of the ts app:

  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  // https://gist.github.com/cecilemuller/2963155d0f249c1544289b78a1cdd695
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "ts-node",
      "type": "node",
      "request": "launch",
      "runtimeExecutable": "node",
      "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],

      "args": ["${file}"],
      
      "cwd": "${workspaceRoot}/process-library",
      "internalConsoleOptions": "openOnSessionStart",
      "skipFiles": ["<node_internals>/**", "node_modules/**"]
    }
    
  ]
}

@prmichaelsen
Copy link

Wow, I have never had a VS Code debug configuration work perfectly the first time I ran it. Thanks a bunch

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