Skip to content

Debuggin works only with javascript, not typescript #104

Open

Description

@aabluedragon

Hello,

I've noticed that breakpoints only work when placing them in .jsx files... meaning .tsx file breakpoints are ignored, even though there sourcemaps.

Do I have anything misconfigured on my side, or is this the status quo?

Also debugger; statements are not caught, only breakpoints you mark actually do halt execution.

Activity

  1. lewiji commented on Jun 3, 2021

    @lewiji
    Contributor

    Iirc, I had to set the mapping from JS to TS using an absolute rather than relative path in my tsconfig to get it to work, but then I could indeed debug from typescript directly. Haven't got the project in front of me to check, but if that doesn't work let me know and I'll see if I can find more details.

  2. aabluedragon commented on Jun 4, 2021

    @aabluedragon
    Author

    Nothing helps, including writing the absolute path in sourceRoot or rootDir entries in tsconfig.

  3. lewiji commented on Jun 5, 2021

    @lewiji
    Contributor

    Here's an example tsconfig.json and .vscode/launch.json from a project where I used to debug in TS. I haven't used it in a while (since around January) so I haven't verified these with the latest version but hopefully it helps to verify your config.

    tsconfig.json

    {
    	"include": ["./scripts"],
    	"exclude": [".import", "./compiled/", "./node_modules"],
    	"compilerOptions": {
                    "rootDir": "./scripts",
                    "outDir": "./compiled",
    		"target": "ESNext",
    		"module": "ESNext",
    		"moduleResolution": "node",
    		"lib": ["ESNext"],
    		"experimentalDecorators": true,
    		"jsx": "preserve",
    		"sourceMap": true,
                    "sourceRoot": "/home/ljp/godot/proj/Dungen/scripts/",
    		"strict": false,
    		"resolveJsonModule": true,
    	}
    }
    
    

    I'm not sure exactly which of the options are required to have this functionality work, but I think what worked for me is having the rootDir/outDir set to relative paths, the sourceRoot set to the absolute path of the rootDir, and sourceMap set to true, the other options may not be necessary, but worth experimenting with if those don't work alone.

    For the VS Code debug config, I also had sourceMaps set to true there (assuming you're using VS Code):

    .vscode/launch.json

    {
      "version": "0.2.0",
      "configurations": [
        {
          "type": "godot-quickjs",
          "request": "launch",
          "name": "Launch Godot Game",
          "program": "/home/ljp/godot/godot.x11.opt.tools.64",
          "sourceMaps": true,
        }
      ]
    }
    
  4. aabluedragon commented on Jun 5, 2021

    @aabluedragon
    Author

    I tried playing around with these options, without success.
    I'm using Windows btw, seeing your paths /home/ljp/godot/godot.x11.opt.tools.64 looks like your on a POSIX system.
    maybe that's why it doesn't work?

  5. vexCoder commented on Aug 7, 2022

    @vexCoder

    Did you manage to find a solution for this?

  6. added
    debuggerFeatures/issues for debugger with vscode
    on Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    debuggerFeatures/issues for debugger with vscode

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions