我想使用 VSCode 调试打字稿 feathersjs 项目,但是当我启动程序时出现错误
"无法启动程序'[project_path]/src/index.ts',因为 找不到相应的 JavaScript。">
我的launch.json看起来像这样:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/lib/**/*.js"
]
}
]
}
未生成打字稿源映射。
要解决此问题,请转到tsconfig.json
并在compilerOptions
上添加'"sourceMap": true'
。
{
"compilerOptions": {
"target": "es2018",
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"sourceMap": true
},
"exclude": [
"test"
]
}