ECMAScript
ECMAScript copied to clipboard
Debuggin works only with javascript, not typescript
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.
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.
Nothing helps, including writing the absolute path in sourceRoot or rootDir entries in tsconfig.
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,
}
]
}
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?
Did you manage to find a solution for this?