phaser-3-vsc-typescript-nodejs icon indicating copy to clipboard operation
phaser-3-vsc-typescript-nodejs copied to clipboard

[Question] How to debug TS in VSCode?

Open fregate opened this issue 2 years ago • 1 comments

Hello

Thank you for this outstanding template! I have a question.

I'm at very beginning in web-node-etc development and trying set up environment as I did for C++, Rust and so on. I run this template (without any changes) in VSCode: select "Run Script: start:dev". After hitting F5 (or 'play') everything starts (template works), but I all breakpoints is empty circles - 'Unbound breakpoints'.

How I can use this template and debug code inside VSCode? Is there some way to do it?

Thanks

fregate avatar Jan 09 '23 04:01 fregate

Made some investigation and now I can use this template and debug TypeScript directly in VSCode (and Chrome). But I have to start start http server before debug manually.

"scripts": {
	"serve": "webpack --mode production && http-server public",
}

in shell 'npm run serve'

and in launch.json

{
	"type": "chrome",
	"request": "launch",
	"name": "Launch Chrome",
	"url": "http://127.0.0.1:8080",
	"preLaunchTask": "npm: build",
	"sourceMapPathOverrides":{
		"webpack:///./~/*": "${workspaceFolder}/node_modules/*",
		"webpack://?:*/*": "${workspaceFolder}/*"
	},
	"outFiles": ["${workspaceFolder}/public/**/*.js"],
	"webRoot": "${workspaceFolder}/public/"
}

I can pull this in master, but maybe there is a way to run everything in run task?

fregate avatar Jan 09 '23 15:01 fregate