1、vscode安装插件 JavaScript Debugger(Nightly)
2、调试配置,路径.vscode/launch.json
如下
{
// 使用 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}"
}
}
]
}