weixin_39630813
weixin_39630813
2020-12-28 08:01

debugging

I can't see sourcemaps when debugging in chrome, only plain js. How to debug code with this template?

该提问来源于开源项目:rroylance/phaser-ce-npm-webpack-typescript-starter-project

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

8条回答

  • weixin_39861627 weixin_39861627 4月前

    This project doesn't have source map support now. Hope to add it!

    点赞 评论 复制链接分享
  • weixin_39958248 weixin_39958248 4月前

    I'm looking into getting sourcemaps and possibly breakpoints working. Hopefully soon! Thanks.

    点赞 评论 复制链接分享
  • weixin_39958248 weixin_39958248 4月前

    I've been able to get it to source map to the individual files, however it maps to the compiled typescript, not the typescript itself... any idea how to get it to map to the typescript, I'm having no luck and searches isn't helping ? The compiled typescript is pretty close to the actual code, so it'd definitely be better than nothing if getting typescript mapping is not possible at the moment.

    Let me know if you'd like the current mapping (to the compiled typescript) committed or if you'd rather wait for typescript mapping.

    点赞 评论 复制链接分享
  • weixin_39898550 weixin_39898550 4月前

    What do you mean the compiled Typescript?

    Ideally all you need is an inline-sourcemap in the bundled file.

    点赞 评论 复制链接分享
  • weixin_39898550 weixin_39898550 4月前

    See https://github.com/rroylance/phaser-npm-webpack-typescript-starter-project/pull/18

    The following are instructions to get this working with Visual Studio Code and Chrome. Tested and working on Arch Linux.

    1. Install Debugger For Chrome in VSCode
    2. Launch the dev server npm run server:dev
    3. Launch VSCode's debugger
    4. Enjoy!

    Here is my launch.json file which launches a standalone chrome window:

    json
    {
      "version": "0.2.0",
      "configurations": [
        {
          "type": "chrome",
          "request": "launch",
          "name": "Launch Chrome",
          "url": "http://localhost:9000",
          "webRoot": "${workspaceRoot}",
          "userDataDir": "${workspaceRoot}/.vscode/chrome",
          "runtimeExecutable": "/usr/bin/google-chrome-stable"
        },
        {
          "type": "chrome",
          "request": "attach",
          "name": "Attach to Chrome",
          "port": 9222,
          "webRoot": "${workspaceRoot}"
        }
      ]
    }
    

    ( runtimeExecutable is needed in my case because my executable's name is non-standard, you will likely not need it)

    点赞 评论 复制链接分享
  • weixin_39958248 weixin_39958248 4月前

    By compiled TypeScript I mean the JS that gets generated. I only got it to show where the issue was in the JS that's generated, not the original TS. I'll merge your update in and see if that satisfies those that need it. Thanks.

    点赞 评论 复制链接分享
  • weixin_39898550 weixin_39898550 4月前

    I'll test the workflow on Windows tomorrow and update the readme accordingly :)

    点赞 评论 复制链接分享
  • weixin_39958248 weixin_39958248 4月前

    Thanks for the help!

    点赞 评论 复制链接分享

相关推荐