12

I'm trying to debug TS project. WebStorm automatically picks up source maps and show original ts files. I don't want to use source maps and debug generated js files. How can I disable usage of source maps in WebStorm?

NOTE: this question is not about how to disable source maps generation, it's about how to disable source maps usage during debugging

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Max Koretskyi
  • 101,079
  • 60
  • 333
  • 488
  • Why do you want to create the source map, but not use it? – Sefe Jan 27 '17 at 14:01
  • I didn't create them, they are created by a package authors – Max Koretskyi Jan 27 '17 at 14:02
  • 2
    no way; when the generated file is loaded, debugger finds the sourcemap by `//# sourceMappingURL` comment in it and then resolves original file using sourcemap. You can try deleting the comments from generated files (if you are permitted to do this) – lena Jan 27 '17 at 14:09
  • @lena, thanks, that's sad. are there any plans to provide options for that? – Max Koretskyi Jan 27 '17 at 14:12
  • you are the first user asking for such possibility; so no - no plans so far – lena Jan 27 '17 at 14:14
  • you can try using FireFox for debugging - sourcemaps don't work when using it... You need using FireFox Remote configuration for this. Please see https://www.jetbrains.com/help/webstorm/2016.3/debugging-javascript.html#d317892e172 – lena Jan 27 '17 at 14:19
  • I ran into this right now when debugging subscriptions-transport-ws package. It has sourcemaps in the dist, but the package doesn't contain the src. – VaclavSir Sep 11 '18 at 09:38
  • The only way I found in Webstorm was also removing these comments. But VSCode can disable sourcemaps, maybe next time I'll try that editor instead - https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps – VaclavSir Sep 11 '18 at 09:41

1 Answers1

11

One option is to check if there's a tsconfig.json file and in it, you can disable the sourceMap generation:

{
  "compilerOptions": {
    "sourceMap": false
  }
}

Another option, is to disable the use of source map files in your browser's debugger, for instance in Chrome you can uncheck this option:

enter image description here

Under Settings -> Preferences

thitemple
  • 5,833
  • 4
  • 42
  • 67
  • 5
    as I mention in my question, `this question is not about how to disable source maps generation, it's about how to disable source maps usage during debugging` and I'm debugging in WebStorm, not a browser – Max Koretskyi Jan 27 '17 at 14:13