question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to debug typescript code in Android

See original GitHub issue

I’ve created a project with Ionic 4, added Capacitor to it and run the app in Android Studio. Them using Chrome “chrome://inspect/#devices” I tried to debug the app but only the transpiled javascript code is available. I cannot see my typescript code an put breakpoints in it…

Ionic:
   ionic (Ionic CLI)          : 4.0.5 (/home/xpto/sw/nodejs/versions/node-v8.11.3-linux-x64/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.1
   @angular-devkit/core       : 0.7.2
   @angular-devkit/schematics : 0.7.2
   @angular/cli               : 6.1.2
   @ionic/ng-toolkit          : 1.0.5
   @ionic/schematics-angular  : 1.0.4

Capacitor:
![no-typescript](https://user-images.githubusercontent.com/5212564/43895819-78085878-9bce-11e8-85dd-e72596395ba3.png)

   capacitor (Capacitor CLI) : 1.0.0-beta.4
   @capacitor/core           : 1.0.0-beta.4

System:
   NodeJS : v8.11.3 (/home/xpto/sw/nodejs/versions/node-v8.11.3-linux-x64/bin/node)
   npm    : 5.6.0
   OS     : Linux 4.15

I don’t know if it’s an Ionic or a Capacitor bug, so if I’ve creating it in the wrong project just let me know and I will create it in the other one 😃

Thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ryaacommented, Feb 6, 2019

To whom it may concern, here is the approach I implemented to enable debugging with source maps support on Android devices

  • install ngx-build-plus by running npx ng add ngx-build-plus
    This will install the required npm package and update angular.json as required For more details please see https://github.com/manfredsteyer/ngx-build-plus
  • create new file build-customization-plugin.js in the project root directory and add the below content in this file
var merge = require('webpack-merge');

exports.default = {
    config: function (cfg) {
        const strategy = merge.strategy({
            'devtool': 'replace',
        });

        return strategy(cfg, {
            devtool: 'inline-source-map'
        });
    }
}
  • run ng build --eval-source-map --plugin ~build-customization-plugin.js from the root directory to build the project with source maps to debug on Android devices

This is a better approach then changing angular/cli source 😃

0reactions
ionitron-bot[bot]commented, Nov 14, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript debugging with Visual Studio Code
Debugging TypeScript. Visual Studio Code supports TypeScript debugging through its built-in Node.js debugger and Edge and Chrome debugger.
Read more >
Not able to debug in TypeScript - VS Code - Stack Overflow
I have set target to "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "--remote-debugging-port=9222" in Chrome Properties.
Read more >
Running and debugging TypeScript | IntelliJ IDEA ... - JetBrains
With IntelliJ IDEA, you can run and debug client-side TypeScript code and TypeScript code running in Node.js.
Read more >
Debug a JavaScript or TypeScript app - Visual Studio (Windows)
To enable debugging using Visual Studio, you need to make sure that the reference(s) to your source file in the generated source map...
Read more >
debugger - JavaScript - MDN Web Docs
The following example shows code where a debugger statement has been inserted, to invoke a debugger (if one exists) when the function is ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found