gpt4 book ai didi

android - Android 设备上的 Ionic 2 中未显示 Typescript sourcemaps

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:25 25 4
gpt4 key购买 nike

我遇到了一个奇怪的 Ionic2 行为。当我将我的应用程序部署到模拟器时,我可以在 chrome 检查调试器中看到 .ts 文件 sourceMap。

在这两种情况下,我都使用:

ionic run android

enter image description here

另一方面,当我在真实设备上部署我的 apk 时,“源”选项卡与其他目录组完全不同,并且没有引用我的 .ts 文件。

enter image description here

我的环境是:

  • OS X 10.11
  • ionic 2 2.0.0-beta.35
  • Cordova 6.3.0

该项目最初由以下人员生成:

ionic start biblio tutorial --v2

ionic.config.json

{
"name": "biblio",
"app_id": "",
"v2": true,
"typescript": true
}

tsconfig.json

 {
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"filesGlob": [
"**/*.ts",
"!node_modules/**/*"
],
"exclude": [
"node_modules",
"typings/global",
"typings/global.d.ts"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}

有什么想法吗?

最佳答案

对我来说,问题是当您在 Android 设备上进行远程调试时,Chrome 调试器无法访问设备上的源映射文件。解决方案/修复是内联包含源映射。为此,我:

将以下内容添加到根项目目录中的 package.json

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

这是为了让 webpack 添加源映射内联更改 tsconfig.js 行

"sourceMap": true,

"sourceMap": false

这是为了禁止 typescript 创建源映射文件,因为这是由 webpack 完成的。

此更改后,一切似乎都运行良好。请注意,这适用于 ionic 2 RC_04

关于android - Android 设备上的 Ionic 2 中未显示 Typescript sourcemaps,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38723019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com