You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vscode launch config ts-node with tsconfig-paths #777
The readme explains how to configure a vscode task that launches a .ts file, but how do we pass e.g. the --project argument in this case?
This is what I'm trying, but it just gives me a bad option: --project error - which actually makes sense, if it, as I understand it, just registers ts-node as a loader for .ts files.
And on a side note, the above is actually not even what I originally set out to achieve.
What I really wanted, was to launch and debug an NPM package script, defined in package.json as:
Right, it actually looks like #734 answers my first question. I'd still love to know if there's a way to just debug the NPM package script though, as replicating all the scripts in the vscode launch config is not exactly ideal.
Oh, and please merge #738, so no more time will be wasted on this :-)
Reacted by Marluan Espiritusanto, Cameron Ellis, Bobur Kobilov, Matheus Peressoni, Lukas Oslislo, Simon Somlai, John Trump, Eduardo Giroto, Guihgo, paul-b and 5 more
Reacted by Bobur Kobilov and Simon Somlai
Reacted by Bobur Kobilov and Simon Somlai
Reacted by Bobur Kobilov, Simon Somlai, Guihgo and DoDoSt
Hmm, now I wonder if we're actually talking about two different things here...
I thought this issue was about how to specify the path to the tsconfig.json file, which is what the --project argument is for. But what you are doing there looks like something entirely different, so if that's the case, sorry for hijacking the issue :-)
Activity
thomas-darling commentedon Feb 9, 2019
Yeah, I can't figure this out either...
The readme explains how to configure a vscode task that launches a
.tsfile, but how do we pass e.g. the--projectargument in this case?This is what I'm trying, but it just gives me a
bad option: --projecterror - which actually makes sense, if it, as I understand it, just registersts-nodeas a loader for.tsfiles.{ "type": "node", "request": "launch", "name": "Develop", "runtimeArgs": [ "-r", "ts-node/register" ], "args": [ "--project", "${workspaceRoot}/tools/tsconfig.json", "${workspaceRoot}/tools/scripts/develop.ts" ], "console": "integratedTerminal" }And on a side note, the above is actually not even what I originally set out to achieve.
What I really wanted, was to launch and debug an NPM package script, defined in
package.jsonas:But I cannot for the life of me figure out how to make either of those work.
Any guidance would be much appreciated :-)
thomas-darling commentedon Feb 9, 2019
Right, it actually looks like #734 answers my first question. I'd still love to know if there's a way to just debug the NPM package script though, as replicating all the scripts in the vscode launch config is not exactly ideal.
Oh, and please merge #738, so no more time will be wasted on this :-)
yantrab commentedon Feb 9, 2019
@thomas-darling what is project pipe do?
thomas-darling commentedon Feb 9, 2019
Hmm, now I wonder if we're actually talking about two different things here...
I thought this issue was about how to specify the path to the
tsconfig.jsonfile, which is what the--projectargument is for. But what you are doing there looks like something entirely different, so if that's the case, sorry for hijacking the issue :-)caseyduquettesc commentedon Feb 16, 2019
The answer is in the README
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Server", "protocol": "inspector", "runtimeVersion": "8.11.4", "runtimeArgs": ["-r", "ts-node/register", "-r", "tsconfig-paths/register"], "args": ["src/main.ts"], "cwd": "${workspaceFolder}", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "env": { "TS_NODE_PROJECT": "tsconfig.json", "TS_NODE_TRANSPILE_ONLY": "true" } } ] }stepli1010 commentedon Mar 28, 2019
good~
Guihgo commentedon Aug 30, 2020
create scripts on package.json and use the runtimeExecutable and runtimeArgs on .vscode/launch.json:
package.json
{ "name": "someproject", "version": "1.0.0", "description": "Some project", "main": "index.js", "author": "Guihgo", "license": "MIT", "scripts": { "dev": "tsnd -r tsconfig-paths/register --transpile-only --respawn --ignore-watch node_modules src/index.ts", "build": "tsc", "test": "jest" }, "private": false, "devDependencies": { [...] }, "dependencies": {} }.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "DEV", "type": "node", "request": "launch", "restart": true, "skipFiles": [ "<node_internals>/**" ], "runtimeExecutable": "yarn", "runtimeArgs": [ "dev" ] }, { "name": "TEST", "type": "node", "request": "launch", "restart": true, "skipFiles": [ "<node_internals>/**" ], "runtimeExecutable": "yarn", "runtimeArgs": [ "test" ] } ] }in runtimeExecutable you can set to npm, but i thinks you needs add "run" argumment on runtimeArgs as following
.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "DEV", "type": "node", "request": "launch", "restart": true, "skipFiles": [ "<node_internals>/**" ], "runtimeExecutable": "npm", "runtimeArgs": [ "run", "dev" ] }, { "name": "TEST", "type": "node", "request": "launch", "restart": true, "skipFiles": [ "<node_internals>/**" ], "runtimeExecutable": "npm", "runtimeArgs": [ "run", "test" ] } ] }