0

Hi there I have very weird problem. I am trying to use sourcemap on one of my clients SharePoint site but on that site they are using could defender app which injects some js codes in my js files and that broke my sourcemaps because browser put the debug point on wrong line in js file.

As you can see in the first screenshot when I add a break point on ts file because of the extra codes that the defender adds break point on the second screen shot is not on the correct line.

Is there anything that I can fix that problem. Thanks a lot

enter image description here

enter image description here

Mustafa Yılmaz
  • 245
  • 3
  • 12
  • I recommend a solution to "not use sourcemap". As you code is not minified that may be not a problem. – Dimava Dec 10 '22 at 15:10

1 Answers1

0

You have a few of workarounds:

  1. Try using using DevTools overrides to run the site using a local copy in which you remove the injected code to make the source map match the code again.

  2. Disable source maps in DevTools and debug JavaScript instead of TypeScript. If the code is not minified, it is usually easy to follow.

Tanek Loc
  • 361
  • 6
  • Hi, option 1 is not usable for me, it is SharePoint online site and I need to debug my code on the live environment in order to access data and pass authentication. As for option 2 yes I can debug js code but it is bit more hard to find some things in ts while looking only in js side and also I am new in ts so I want to learn a bit :) – Mustafa Yılmaz Dec 10 '22 at 17:58
  • @MustafaYılmaz it works on the live site and allows you to tweak the code of the live site... – Tanek Loc Dec 10 '22 at 17:59
  • Wouv didn't know that, thanks a lot. I am using Firefox normally that's why local overrides was an unknown thing for me. – Mustafa Yılmaz Dec 10 '22 at 19:01