如何在 WebStorm 中调试 node.js app 运行 TypeScript?
How to debug node.js app running with TypeScript in WebStorm?
如何在 WebStorm 中调试 node.js 应用 运行 TypeScript?
更新 tsconfig.json 以在 compilerOptions
中添加 sourceMap=true
属性
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitReturns": true,
"outDir": "lib",
"target": "es6",
"preserveConstEnums": true,
"removeComments": false,
"sourceMap": true,
"inlineSources": true,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"node_modules",
"lib"
]
}
在编辑Run/Debug配置中,
- 在 节点参数 字段中写入以下行。不要忘记提及您的端口号!在我的例子中是 3000
--inspect=3000 --require ts-node/register
在 Javascript 文件 字段中提及您的条目 .ts 文件。在我的例子中是 bin/www.ts
调试新创建的配置
如何在 WebStorm 中调试 node.js 应用 运行 TypeScript?
更新 tsconfig.json 以在 compilerOptions
sourceMap=true
属性
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"noImplicitReturns": true,
"outDir": "lib",
"target": "es6",
"preserveConstEnums": true,
"removeComments": false,
"sourceMap": true,
"inlineSources": true,
"typeRoots": [
"./node_modules/@types"
]
},
"exclude": [
"node_modules",
"lib"
]
}
在编辑Run/Debug配置中,
- 在 节点参数 字段中写入以下行。不要忘记提及您的端口号!在我的例子中是 3000
--inspect=3000 --require ts-node/register
在 Javascript 文件 字段中提及您的条目 .ts 文件。在我的例子中是 bin/www.ts
调试新创建的配置