美文网首页
使用VS Code+Chrome调试cocos creator

使用VS Code+Chrome调试cocos creator

作者: Jey | 来源:发表于2020-05-20 10:00 被阅读0次
    1. 在VS里面安装插件Debugger for Chrome


      2FC3567A-68B8-49C1-869D-32A5BEC9E060.png
    2. 打开运行


      6F4A0F01-0E5F-4D15-AE39-72CF9DDE6E42.png

    发现出现访问失败:


    56FDEE35-57DC-45BC-976B-E9156787F745.png
    1. 修改launch.json
      原来是这样:
    {
        // 使用 IntelliSense 了解相关属性。 
        // 悬停以查看现有属性的描述。
        // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "type": "chrome",
                "request": "launch",
                "name": "Launch Chrome against localhost",
                "url": "http://localhost:8080",
                "webRoot": "${workspaceFolder}"
            }
        ]
    }
    

    修改

    {
        "version": "0.2.0",
        "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:7456",
            "webRoot": "${workspaceRoot}",
            "sourceMapPathOverrides": {
            "assets/*": "${workspaceRoot}/assets/*"
            },
            "sourceMaps": true,
            "userDataDir": "${workspaceRoot}/.vscode/chrome",
            "diagnosticLogging": false,
            "outFiles": [
                "${workspaceRoot}/dist/**/*.ts"
              ]
        }
        ]
    }
    

    大功告成

    相关文章

      网友评论

          本文标题:使用VS Code+Chrome调试cocos creator

          本文链接:https://www.haomeiwen.com/subject/phhgohtx.html