Reputation: 11895
By default (and hopefully it's not the only option) when I have a ts file, Chrome only lets me debug the ts code. I.e it does show me the content of both the ts and js files, but when I try to put a break-point in the js file, it immediately transfers me to the ts file and locates the break-point in the right place.
How can I tell Chrome to debug the js file rather than the ts one?
Upvotes: 27
Views: 9599
Reputation: 1
I assume you are using tsc
to compile.
If so, there is a simple parameter that will tell tsc
to not create source maps and hence not include the # sourceMappingURL=...
directive:
tsc --sourceMap false
Upvotes: 0
Reputation: 17430
Since you don't have control over the TS compilation settings, you can disable JavaScript source maps all together in Chrome.
Load the developer tools (Chrome Menu > More Tools > Developer Tools), then load the developer tool settings (Developer Tools Menu > Settings), find the setting for "Enable JavaScript source maps" and disable it.
Upvotes: 33
Reputation: 24008
If you are in development mode, you should have source mapping between the TypeScript and the transpiled JavaScript. For debugging, you would put breakpoints on the TypeScript code in DevTools, as that is the code you wrote it in. It makes sense to debug the code you wrote.
If you want to debug only the JavaScript, run the application in the deployed mode (no source map), and set the breakpoint on the resulting JavaScript code.
Upvotes: 3