Debugging TypeScript Cordoba Application in VS 2015

The source of Cordova projects typescript is stored outside the www folder. The generated map file indicates the source to which it is not available. How to configure the post-build event to copy the typescript source to the www folder and update the generated map file to allow the debugger to load the correct typescript source file when a breakpoint is hit?

The first requirement emerged by copying the typescript source files to the www folder. Modify the .jsproj project .jsproj and add the following:

 <ItemGroup> <TypeScriptSourceFiles Include="$(ProjectDir)scripts\**\*.ts"></TypeScriptSourceFiles> </ItemGroup> <Target Name="AfterBuild"> <Copy SourceFiles="@(TypeScriptSourceFiles)" DestinationFiles="@(TypeScriptSourceFiles->'$(ProjectDir)www\scripts\ts\%(RecursiveDir)%(Filename)%(Extension)')"></Copy> </Target> 

Now I just need to modify the .js.map file and update the sourceRoot attribute?

Any ideas?

+5
source share
1 answer

Sorry for your troubles. We know that we have some problems with source maps and Typescript, depending on the script you are debugging. The best way to fix this now is to add the following file to the tsconfig.json file:

"inlineSources": true

This will embed your typescript sources in the source map files so that you can debug them in all scripts.

+2
source

All Articles