5

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?

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.