From 588ee21f4da7624219bcb0fc99fd9eabff1c9733 Mon Sep 17 00:00:00 2001 From: Junyi Date: Mon, 6 Jun 2022 23:01:37 +0800 Subject: [PATCH] chore(debug): add debug config (#475) --- .vscode/launch.json | 46 +++++++++++++++++++++++++++ packages/core/cli/src/commands/dev.js | 2 +- tsconfig.json | 7 +++- 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..4feb68bab8 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,46 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Debug Server", + "cmd": "${workspaceRoot}", + "runtimeArgs": [ + "-r", "dotenv/config", + "-r", "tsconfig-paths/register", + "-r", "ts-node/register" + ], + "args": ["${workspaceRoot}/packages/app/server/src/index.ts", "start"], + "port": 9229, + "skipFiles": [ + "/**" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Debug Jest Tests", + "runtimeExecutable": "yarn", + "runtimeArgs": [ + "run", + "--inspect-brk", + "test", + "--runInBand", + // could be any single file path to debug + "${workspaceFolder}/packages/" + ], + "port": 9229, + "skipFiles": [ + "/**" + ], + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } + ] +} diff --git a/packages/core/cli/src/commands/dev.js b/packages/core/cli/src/commands/dev.js index d985d24c6e..1e17dec812 100644 --- a/packages/core/cli/src/commands/dev.js +++ b/packages/core/cli/src/commands/dev.js @@ -73,7 +73,7 @@ module.exports = (cli) => { env: { PORT: clientPort, APP_ROOT: `packages/${APP_PACKAGE_ROOT}/client`, - PROXY_TARGET_URL: serverPort ? `http://127.0.0.1:${serverPort}` : undefined, + PROXY_TARGET_URL: process.env.PROXY_TARGET_URL || (serverPort ? `http://127.0.0.1:${serverPort}` : undefined), }, }); } diff --git a/tsconfig.json b/tsconfig.json index 25aa5ad249..b58d45b6fb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,5 +27,10 @@ "packages/core/*/src" ] } + }, + "ts-node": { + "compilerOptions": { + "module": "commonjs" + } } -} \ No newline at end of file +}