简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM