This command is used to run my server:1
nodemon
-r ts-node/register
-r tsconfig-paths/register
--watch server/
--watch shared/
--ext ts,tsx,json
--inspect-brk=24170
./server/index.ts
The problem is, I need ts-node to receive --project ./tsconfig-server.json rather than using the default tsconfig.json. Simply including it after the -r ts-node/register (or anywhere else) results in a bad option: --project error.
Using --exec 'node ./node_modules/ts-node/dist/bin.js --project ./tsconfig-amd.json' instead of -r ts-node/register works, but then the debugger fails to attach to the process. I assume that’s because it’s trying to attach to the nodemon process rather than the node process that nodemon starts?
But I cannot use the default tsconfig.json filename here, because VS Code does not support specifying an alternative tsconfig.json and the server config is not the one I want to use for viewing and editing the code
- The command is actually produced by VS Code per my
.vscode/launch.jsonwhich looks like this:{ // 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 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "nodemon", "runtimeExecutable": "node", "args": [ "${workspaceFolder}/server/index.ts" ], "runtimeArgs": [ "${workspaceFolder}/node_modules/nodemon/bin/nodemon.js", "-r", "ts-node/register", "-r", "tsconfig-paths/register", "--watch", "server/", "--watch", "shared/", "--ext", "ts,tsx,json" ], "restart": true, "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "protocol": "inspector" } ] }