Typescript 1.0 map files do not load

若如初见. 提交于 2019-12-12 12:14:30

问题


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?


回答1:


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'.



来源:https://stackoverflow.com/questions/23017498/typescript-1-0-map-files-do-not-load

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!