使用VSCode与Chrome调试Cocos Creator项目:完整配置指南 | 南锋

南锋

南奔万里空,脱死锋镝余

使用VSCode与Chrome调试Cocos Creator项目:完整配置指南

1、vscode安装插件 JavaScript Debugger(Nightly)

2、调试配置,路径.vscode/launch.json如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Cocos Chrome",
"url": "http://localhost:7456",
"sourceMaps": true,
"userDataDir": "${workspaceRoot}/.vscode/chrome",
"diagnosticLogging": false,
"webRoot": "${workspaceRoot}",
"sourceMapPathOverrides": {
"assets/*": "${workspaceRoot}/assets/*"
},
"runtimeArgs": ["--disable-web-security"],//解决跨域问题
"pathMapping":{
"/preview-scripts/assets": "${workspaceRoot}/temp/quick-scripts/assets",
"/": "${workspaceRoot}"
},
"runtimeExecutable" : "C:/Program Files/Google/Chrome/Application1/chrome.exe" // chrome浏览器的绝对路径
}
]
}
+