Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging TypeScript Cordova application in VS 2015

A Cordova projects' typescript source is kept outside of the www folder. The generated map file points to source it cannot access. How do I set up a post-build event to copy the typescript source in the www folder and update the generated mapping file to enable the debugger to load the correct typescript source file when a breakpoint is hit?

Figured out the first requirement, copying the typescript source files into the www folder. Edit the .jsproj project file 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 do I just need to modify the .js.map file and update the sourceRoot attribute?

Any ideas?

like image 436
qubit Avatar asked Oct 31 '22 21:10

qubit


1 Answers

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

"inlineSources": true

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

like image 115
Michael Braude Avatar answered Nov 15 '22 06:11

Michael Braude