iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 6
0
AI & Machine Learning

Microsoft Bot Framework 30天上手 + 自幹 Line Builder 串接 + Line Bot Demo系列 第 6

Debug a bot with Visual Studio Code (typescript)

如前篇 Debug a bot with Visual Studio Code (javascript)
因為我要用tpye script 做開發,

tsc --init 
npm install @types/node --save-dev  //先加這個,免得報紅

所以設定上就得複雜一些
tsconfig.json

{
  "compilerOptions": {
      "module": "commonjs",
      "target": "es6",
      "outDir": "dist",
      "rootDir": "src",
      "sourceMap": true
  }
}

將 app.js 改成 app.ts ,並移到 src 作為主要開發目錄,tsc 會將該目錄轉譯到 dist 下
sourceMap 設 true 不然無法debug

.vscode/launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Attach to Process",
            "type": "node",
            "request": "attach",
            "port": 5858,
            "outFiles": [],
            "sourceMaps": true
        }
    ]
}
node --inspect-brk=5858 ./dist/app.js  

這樣就可以順利在*.ts裡 debug了

#附註,還有一堆設定
https://code.visualstudio.com/docs/nodejs/nodejs-debugging


上一篇
Debug a bot with Visual Studio Code (javascript)
下一篇
Dialogs
系列文
Microsoft Bot Framework 30天上手 + 自幹 Line Builder 串接 + Line Bot Demo30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言