Repository navigation
Replies: 1 comment
|
Pass the inspector flag to Node, and preload ts-node plus dotenv. For a CommonJS ts-node setup, run this from the project root: node --inspect-brk=127.0.0.1:4000 -r ts-node/register/transpile-only -r dotenv/config tasks/migration/myScript.ts dotenv_config_path=./local.envThen attach with: {
"version": "0.2.0",
"configurations": [
{
"name": "Attach to migration script",
"type": "node",
"request": "attach",
"address": "127.0.0.1",
"port": 4000,
"skipFiles": ["<node_internals>/**"]
}
]
}
The pieces are independent:
You don't need References: ts-node with Node flags, Node inspector flag, dotenv preload configuration, VS Code attach configuration. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How to attach the VSCode debugger to the
ts-nodecommand that uses env variables like the below one:package.json:
I tried adding flags
--respawn --inspect=4000to the above command with below launch.json, but it didn't work:launch.json:
All reactions