Rya*_*ton 5 debugging typescript visual-studio-code
这是我的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"
},
Run Code Online (Sandbox Code Playgroud)
我的源文件夹:
我的dist文件夹:
我得到的错误是:
Cannot launch program '/Dev/myapp/server/src/app.ts'; setting the 'outFiles' attribute might help.
Run Code Online (Sandbox Code Playgroud)
如果我将"program"属性更改为""program":"$ {workspaceRoot} /dist/server/src/app.js",它可以工作,但我正在调试已转换的javascript而不是打字稿.显然是转换用.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"
]
}
Run Code Online (Sandbox Code Playgroud)
您缺少src配置中的文件夹:
"outFiles": [
"${workspaceRoot}/dist/server/src/*.js"
],
Run Code Online (Sandbox Code Playgroud)
此外,您的设置mapRoot中tsconfig.json来./dist/.目前,它将在您的./server/src文件夹中搜索源图,而不是./dist
| 归档时间: |
|
| 查看次数: |
6916 次 |
| 最近记录: |