React-native Hermes 生产构建失败

React-native Hermes production build fails

react@17.0.1
react-native@0.63.4

没有 Hermes 的构建工作正常。

使用 Hermes 开发构建工作正常。

如果我注释掉我的所有代码并仅使用 <Text>Works</Text>.

渲染第一个 App.ts,那么使用 Hermes 的生产构建工作正常

如果我放回所有依赖项:Redux、React-navigation、react-native-paper 等 - 构建过程卡在 34%:

...
info Done writing bundle output
info Done writing sourcemap output
info Copying 32 asset files
info Done copying assets
/Users/main/git/my-app/app/android/app/build/generated/assets/react/release/index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...

其余日志遵循相同的模式:

the variable "SOMETHING" was not declared in function "SOMETHING"

react-native run-android --variant=release 没有发出警告,但它与生产版本一样卡住了:

...
info Done copying assets
<=====--------> 41% EXECUTING [3m 20s]
> :app:bundleReleaseJsAndAssets

据我了解,这意味着问题是由我的 npm 依赖项之一引起的。有没有一种简单的方法可以解决这个问题,而无需手动逐一检查每个依赖项?

我已经解决了关于 Whosebug 和 react-native Github 问题的所有相关问题。

我通过构建一个只有一个视图的空 APK,然后插入我的部分代码并一次又一次地构建来找到根本原因。原来这个问题是由我的源代码中的一个大 JSON 文件引起的。

爱马仕有a known bug。而不是加载 .json 文件,我必须加载一个字符串并 JSON.parse() 它。

react@17.0.1react-native@0.63.4

中不支持

react-native@0.63.4 需要 react@16.13.1

https://docs.google.com/spreadsheets/d/19VPB-1Y8vGHhmcklLuF3BNmkmdKUdt7qTRSFTvbTfho/edit?usp=drivesdk https://ads.google.com/aw/campaigns/new/express?campaignId=12498885796&ocid=575495452&cmpnInfo=%7B%228%22%3A%2249c0c2bc-d14e-4795-b26b-496cc400cd6b%22%7D&subid=ALL-vi-et-g-aw-m-home-awhp_xin1_signin%21o2&step=cbdg&euid=444355628&__u=7660468172&uscid=575495452&__c=5732498748&authuser=0&sourceid=empMozilla/5.0 (Linux; Android 9; INE-LX2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.181手机 Safari/537.36https://support.google.com/google-ads/search?hl=en&q=S%E1%BB%91%20du%20tai%20khoan%20Google&from_promoted_search=true