Skip to content

Instantly share code, notes, and snippets.

@zRains
Forked from cecilemuller/launch.json
Created October 20, 2023 16:17
Show Gist options
  • Save zRains/d6ada45fe0b259bd206eeade55a1f8ec to your computer and use it in GitHub Desktop.
Save zRains/d6ada45fe0b259bd206eeade55a1f8ec 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/**"]
}
]
}
@zRains
Copy link
Author

zRains commented Oct 20, 2023

For running ESModules using ts-node you might want to use a task-configuration looking like this:

{
    "type": "node",
    "request": "launch",
    "name": "Launch ESModule TypeScript File",
    "cwd": "${workspaceFolder}",
    "runtimeArgs": [
        "--loader",
        "ts-node/esm",
        "--no-warnings"
    ],
    "program": "{ Path to Your `.ts` File}"
}

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