Windows10下VSCode调试器无法绑定Serverless TypeScript应用断点求助
调试器在Windows系统断点无法触发(Mac环境正常)
环境配置
项目结构
.vscode/ ├─ launch.json .webpack/ ├─ service/ │ ├─ src/ │ │ ├─ MyFunction/ │ │ │ ├─ handler.js │ │ │ ├─ handler.js.map src/ ├─ MyFunction/ │ ├─ handler.ts node_modules/ package.json serverless.yaml tsconfig.json build.tsconfig.json
launch.json 配置
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "DEBUG", "runtimeExecutable": "npm", "console":"integratedTerminal", "cwd": "${fileDirname}", "runtimeArgs": [ "run", "debug" ], "sourceMaps": true, "sourceMapPathOverrides": { "webpack:///./~/*": "${workspaceFolder}/node_modules/*", "webpack:///SOURCE_ROOT/*": "/*" }, } ] }
serverless.yaml 配置
service: my-service plugins: - serverless-offline - serverless-bundle provider: stage: ${opt:stage} name: aws runtime: nodejs16.x timeout: 30 versionFunctions: false memorySize: 128 custom: configFile: ./environmentVariables/${file(../environmentVariables/${opt:stage}.json):stageName, "development"}.json functions: myFunction: handler: src/MyFunction/handler.myFunction events: - http: path: /myFunction method: get cors: origin: '*'
build.tsconfig.json 配置
{ "compilerOptions": { "allowSyntheticDefaultImports": true, "lib": ["es2017"], "moduleResolution": "node", "target": "es2017", "outDir": ".build", "sourceMap": true, "allowJs": true, "noUnusedLocals": true, "baseUrl": "./", "skipLibCheck": true, "sourceRoot": "SOURCE_ROOT", "strictNullChecks": true }, "include": ["**/*.ts"], "exclude": ["node_modules", "**/*.test.ts", "**/dist/**"] }
tsconfig.json 配置
{ "extends": "./build.tsconfig.json", "exclude": ["node_modules", "**/dist/**"] }
package.json 中的debug脚本
"debug": "node --lazy ./node_modules/serverless/bin/serverless offline --stage development --noPrependStageInUrl"
版本信息
- VSCode: 1.70.2
- Node: 14.19.1
- Serverless:
- Framework Core: 3.24.1 (local) 3.24.1 (global)
- Plugin: 6.2.2
- SDK: 4.3.2
- Typescript: 4.5.5
已尝试的解决方案
- 在launch.json中添加/移除
outFiles配置:"outFiles": ["${workspaceFolder}/.webpack/service/src/**/*.js"] - 使用全局serverless命令启动调试
目前上述方法均无效,希望能得到解决思路或方案。
内容的提问来源于stack exchange,提问作者Kento Kawakami
相关产品推荐
相关产品推荐

