这是我的launch.json文件
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "Launch Server",
"request": "launch",
"program": "${workspaceRoot}/server/src/app.ts",
"cwd": "${workspaceRoot}",
"env": {
"NODE_ENV": "dev"
},
"skipFiles": [
"node_modules/**/*.js"
],
"outFiles": [
"${workspaceRoot}/dist/server/src/*.js"
],
"sourceMaps": true,
"stopOnEntry": true,
"console": "internalConsole"
},
我的源文件夹:
我的目标文件夹:
我收到的错误信息是:
Cannot launch program '/Dev/myapp/server/src/app.ts'; setting the 'outFiles' attribute might help.
如果我将 "program" 属性更改为 ""program": "${workspaceRoot}/dist/server/src/app.js",它可以使用,但是我调试的是编译后的 JavaScript 而不是 TypeScript。显然,使用 .map 文件进行转换是有效的,那么问题出在哪里?tsconfig.json
{
"compilerOptions": {
"allowJs": false,
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es6",
"dom"
],
"mapRoot": "./",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "./dist",
"sourceMap": true,
"target": "es6",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"web",
"dist",
"node_modules"
]
}
tsconfig.json
文件吗? - Saravanatsconfig.json
中的mapRoot
设置为./
?你的源映射在disc/server/src/
中,对吗? - Saravana./dist/
?目前它会在您的./server/src
文件夹中搜索源映射,而不是dist
。 - Saravana