4

In VS2013 update 2 RC (Typescript 1.0 RTM) I cannot debug TypeScript files in one of my projects. I have traced this back to the map file declaration. By default my JS file contains:

//# sourceMappingURL=general.js.map

Which should be correct, the map file is in the same folder as the TS and JS files. However it doesn't work. if I manually edit the file, specifying the full path, it works:

//# sourceMappingURL=C:/Users/myname/Documents/Visual Studio 2013/Projects/Test/JSLib/general.js.map

This confuses me, because surely the browser shouldn't understand the full path, eg outside the IISExpress web site?

Can anyone suggest a way to get map files working with the first mapping? Thanks

Windows 8.1 x64, IE11

Update: the app, running through IISExpress, uses Windows authentication. if I turn this off the map files load! Also, checking the output window I see:

SourceMap http://localhost:53524/JSLib/general.js.map read failed: The remote server returned an error: (401) Unauthorized.'iexplore.exe' (Script): Loaded 'http://localhost:53524/JSLib/'.

My IIS Express logs contain

2014-04-12 13:58:24 ::1 GET /JSLib/general.js.map - 53524 - ::1 - - 401 2 5 0

But I can browse to http://localhost:53524/JSLib/general.js.map fine in IE. So what's making the call for the map file (VS?) and how to I get it to use my credentials?

user826840
  • 1,233
  • 2
  • 13
  • 28
  • Assuming that your root folder is the `JSLib` folder, Does it work if you use `/general.js.map`? (If your root folder is the `Test` folder, `/JSLib/general.js.map`) – Fenton Apr 11 '14 at 19:14
  • `Test` is the root, but it doesn't work with `JSLib/general.js.map` with or without a leading slash – user826840 Apr 11 '14 at 20:54

1 Answers1

5

I too have been experiencing this problem. I am sorry to say that I do not know what the root of the problem is. However, I have found a workaround.

Open your project properties and go to the 'TypeScript Build' tab. In the 'Debugging' section, check the 'Specify root directory of the source maps' option and enter the value $(ProjectDir)\Scripts.

This works with Windows Authentication enabled and with the default 'sourceMappingUrl'.

Malgaur
  • 1,842
  • 15
  • 17
  • Great simple solution, thanks! Much better than my PowerShell hack that edited the .js files – user826840 Apr 15 '14 at 09:29
  • 1
    I reported the issue to MS, please add a vote for it? https://connect.microsoft.com/VisualStudio/feedback/details/853320/js-ts-map-files-do-not-work-in-vs2013rc2-with-windows-auth – user826840 Apr 15 '14 at 21:39
  • 1
    I'm still seeing this problem on Update 2 RTM, anyone else? – user826840 May 13 '14 at 13:09
  • 2
    Sorry for dumb question, but where is the 'TypeScript Build' tab located? I don't see it on project properties in VS 2013 Update 2. – Shalom Aleichem Aug 01 '14 at 00:10
  • On VS toolbar, Project -> Properties -> TypeScript Build tab will be on the bottom left. Or in VS Solution Explorer, right-click your project and choose Properties. – Malgaur Aug 01 '14 at 14:44
  • I don't see such tab there. One possibility is that this is happening because I'm having a different project type - it's a Win8.1 JavaScript modern app. I'm also having problems debugging TypeScript, while debugging JavaScript works fine. – Shalom Aleichem Aug 01 '14 at 18:04
  • Typescript Build tab does not exist in ASP.net Core 1.0 template in VS2015 – TetraDev May 19 '16 at 19:14