Egret之Visual Studio Code環境配置
阿新 • • 發佈:2018-04-03
Egret Visual Studio Code VSC 一 : 為VSC安裝插件 , 一共為2個
1‘ 是Chrome插件 , 2‘ Egret插件
具體步驟
①:
②:
③:
二 : 配置 launch.json / tasks.json
1‘ 按 F5 選擇 Chrome , 可以生成 launch.json
2‘ 配置launch.json
①,加入配置:
{ "name": "使用本機 Chrome 調試", "type": "chrome", "request": "launch", // "file": "index.html", "url": "http://10.10.20.120:3000/index.html", //使用外部服務器時,請註釋掉 file, 改用 url, 並將 useBuildInServer 設置為 false "http://mysite.com/index.html "runtimeExecutable": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", // 改成您的 Chrome 安裝路徑 "sourceMaps": true, "webRoot": "${workspaceRoot}", "preLaunchTask":"build", "userDataDir":"${tmpdir}", "port":5433 }
如下圖:
3‘ 配置tasks.json
原始文件:
換成如下文件:
{ "version": "0.1.0", "command": "egret", "isShellCommand": true, "tasks": [ { "taskName": "build", "showOutput": "always", "args": [ "build", "-sourcemap" ], "problemMatcher": "$tsc" }, { "taskName": "clean", "showOutput": "always", "args": [ "build", "-e" ], "problemMatcher": "$tsc" }, { "taskName": "publish", "showOutput": "always", "args": [ "publish" ], "problemMatcher": "$tsc" } ] }
結果如下:
三 : ctrl +shift + p -> egret StartServer
開始啟動遊戲吧.........
Egret之Visual Studio Code環境配置