在设备上调试Ionic 3代码 [英] Debug Ionic 3 code on the device

查看:693
本文介绍了在设备上调试Ionic 3代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试Ionic 3,到目前为止一切正常。我希望在离子实验室调试TS代码,所以我在package.json中添加了下一个配置:

I am testing Ionic 3, so far everything works as it should. I would wish to debug the TS code on the ionic lab so i added the next configuration in package.json:

"config": {
    "ionic_source_map": "source-map"
}

之后这个,我能够看到代码并调试它(在chrome devTools中),但是当我在手机上执行相同的测试时,我无法看到.Ts文件并对其进行调试。任何人都知道在手机上可以看到哪些配置或如何使它们可见?

After this, i was able to see the code and debug it(in chrome devTools), but when i execute the same test on the phone i am not able to see the .Ts files and debug it. Anyone has any idea which configuration or how to make them also visible on the phone?

推荐答案

我也遇到过这个问题,但是解决方案很简单:)
运行命令:

I also faced with this problem, but solution is simple :) Run command:

ionic cordova emulate android -l --debug





  • -l <​​/ strong>旋转服务器以实时重新加载www文件

  • -l Spin up server to live-reload www files

- debug 标记为调试版本

因此,在使用检查设备/虚拟设备时:chrome:// inspect ,你可以在网络应用程序中调试打字稿文件,设置断点等。

So, when inspecting device/virtual device with chrome://inspect, you can debug typescript files, set breakpoints etc as in web app.


调试:

Debugging:


  • 在Chrome中,转到网址栏中的chrome:// inspect。

  • 点击您设备上应用的WebView中的检查。


这篇关于在设备上调试Ionic 3代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆