cocosCreator使用Vscode+chrome浏览器调试

2023-10-15 14:06:04 浏览数 (1)

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

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

代码语言:javascript复制
{
   // 使用 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}"
           }
       }
   ]
}

0 人点赞