首页 > 解决方案 > 无法调试模拟的 Ionic 应用程序 - 缩小代码

问题描述

运行这个命令...

ionic cordova emulate android

问题是在调试时,所有代码都被缩小了(vendor.js 和 main.js)——很难调试。

我该如何解决这个问题?我希望看到这两者,因为我的 vendor.js 正在引发错误。我确定有一个 Ionic 设置可以阻止此操作,但我检查了文档并进行了多次搜索,但找不到任何东西。

版本是离子 3。

离子信息内容...

Ionic:

   ionic (Ionic CLI)  : 4.1.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.0
   Cordova Plugins       : cordova-plugin-ionic 4.2.0, cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.3, (and 16 other plugins)

System:

   NodeJS : v10.10.0 (/usr/local/Cellar/node/10.10.0/bin/node)
   npm    : 6.4.1
   OS     : macOS High Sierra

谢谢!

标签: cordovaionic-frameworkionic3

解决方案


选项 1: 使用--livereload参数运行。我发现在进行远程调试时使用实时重新加载比不使用实时重新加载更一致地提供源映射。

选项 2: 将以下内容添加到您的 package.json 文件中。这也适用于我。不确定这是否会影响产品构建,因此您可能只想在主动调试时使用这个。

"config": {
    "ionic_bundler": "webpack",
    "ionic_source_map_type": "#inline-source-map"
}

推荐阅读