react-native: Crash in iOS release due to javascritp RangeError: Maximum call stack size exceeded.
Description
When we run our app in release mode for iOS, it crashes with the following stack. We used bundle --minify false
to get a better stack trace. The trace contains loadModuleImplementation()
function which is defined in metro package. This crash doesn’t happen in Android or debug mode.
2021-11-29 08:18:14.221855-0600 myapp[1194:230119] 8.8.0 - [Firebase/Analytics][I-ACS025028] AdMob and Firebase are in use in this app, but are not linked. For analytics data consistency and integrity, it is highly recommended that you link your AdMob app to the corresponding Firebase app and re-download the GoogleServices-Info.plist file. See https://support.google.com/admob/answer/6383165 for more information.
2021-11-29 08:18:14.222457-0600 myapp[1194:230119] 8.8.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2021-11-29 08:18:14.229414-0600 myapp[1194:229976] [Bugsnag] [INFO] Last run terminated due to a crash.
2021-11-29 08:18:14.265322-0600 myapp[1194:229976] [Bugsnag] [INFO] Sending launch crash synchronously.
2021-11-29 08:18:14.284072-0600 myapp[1194:229976] [native] Running application myapp ({
initialProps = {
};
rootTag = 1;
})
2021-11-29 08:18:14.328787-0600 myapp[1194:229976] [native] Initializing SQLitePlugin
2021-11-29 08:18:14.328984-0600 myapp[1194:229976] [native] Detected docs path: /var/mobile/Containers/Data/Application/DC8F501F-C8B0-4AED-8B76-D9ACD680898C/Documents
2021-11-29 08:18:14.329066-0600 myapp[1194:229976] [native] Detected Library path: /var/mobile/Containers/Data/Application/DC8F501F-C8B0-4AED-8B76-D9ACD680898C/Library
2021-11-29 08:18:14.329168-0600 myapp[1194:229976] [native] no cloud sync at path: /var/mobile/Containers/Data/Application/DC8F501F-C8B0-4AED-8B76-D9ACD680898C/Library/LocalDatabase
2021-11-29 08:18:14.443775-0600 myapp[1194:230186] 8.8.0 - [Firebase/Analytics][I-ACS023007] Analytics v.8.8.0 started
2021-11-29 08:18:14.443960-0600 myapp[1194:230186] 8.8.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2021-11-29 08:18:14.444260-0600 myapp[1194:230186] 8.8.0 - [Firebase/Analytics][I-ACS025026] Deferring to Firebase for event data collection
2021-11-29 08:18:14.598558-0600 myapp[1194:230032] 8.8.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2021-11-29 08:18:14.674145-0600 myapp[1194:230032] 8.8.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2021-11-29 08:18:14.674418-0600 myapp[1194:230032] 8.8.0 - [Firebase/Analytics][I-ACS023220] Analytics screen reporting is enabled. Call +[FIRAnalytics logEventWithName:FIREventScreenView parameters:] to log a screen view event. To disable automatic screen reporting, set the flag FirebaseAutomaticScreenReportingEnabled to NO (boolean) in the Info.plist
2021-11-29 08:18:14.688141-0600 myapp[1194:230182] [javascript] RangeError: Maximum call stack size exceeded.
2021-11-29 08:18:14.692289-0600 myapp[1194:230032] [native] Unhandled JS Exception: RangeError: Maximum call stack size exceeded.
INFO : BSG_KSCrashReport.c:1522: bsg_kscrashreport_writeStandardReport(): Writing crash report to /var/mobile/Containers/Data/Application/DC8F501F-C8B0-4AED-8B76-D9ACD680898C/Library/Application Support/com.bugsnag.Bugsnag/com.myapp.music/v1/KSCrashReports/CrashReport-29F73A7E-1414-4F27-A496-0B2F8DB6E822.json
2021-11-29 08:18:14.873873-0600 myapp[1194:230032] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: RangeError: Maximum call stack size exceeded.', reason: 'Unhandled JS Exception: RangeError: Maximum call stack size exceeded., stack:
loadModuleImplementation@174:13
<unknown>@56015:26
loadModuleImplementation@174:13
<unknown>@55915:34
loadModuleImplementation@174:13
<unknown>@55848:54
loadModuleImplementation@174:13
<unknown>@55358:51
loadModuleImplementation@174:13
<unknown>@53689:49
loadModuleImplementation@174:13
<unknown>@800:47
loadModuleImplementation@174:13
guardedLoadModule@96:46
global code@199173:3
'
*** First throw call stack:
(0x181d91cac 0x198e00758 0x100be31c0 0x100c5e03c 0x100c5e964 0x181d208e0 0x181d3c5b8 0x181d7081c 0x100c1275c 0x100c148b4 0x100c14624 0x181a5d2ec 0x181a5e2f0 0x181a0454c 0x181a04ff0 0x181a0eae4 0x1db716f38 0x1db716aa4)
libc++abi: terminating with uncaught exception of type NSException
2021-11-29 08:18:14.875246-0600 myapp[1194:230182] [javascript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
The issue started to happen about 2 weeks ago after updating dependencies, so we roll backed our yarn.lock and begin to interactively update depndencies in our project. So far, I find that the following change will break the app:
git diff yarn.lock|egrep '[\+\-]\s*resolu' > diff-yarn.txt
- resolution: "@babel/code-frame@npm:7.14.5"
- resolution: "@babel/compat-data@npm:7.15.0"
- resolution: "@babel/core@npm:7.15.5"
- resolution: "@babel/generator@npm:7.15.4"
- resolution: "@babel/helper-annotate-as-pure@npm:7.15.4"
- resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.15.4"
+ resolution: "@babel/helper-annotate-as-pure@npm:7.16.0"
- resolution: "@babel/helper-compilation-targets@npm:7.15.4"
+ resolution: "@babel/helper-builder-binary-assignment-operator-visitor@npm:7.16.0"
- resolution: "@babel/helper-create-class-features-plugin@npm:7.15.4"
+ resolution: "@babel/helper-create-class-features-plugin@npm:7.16.0"
- resolution: "@babel/helper-create-regexp-features-plugin@npm:7.14.5"
+ resolution: "@babel/helper-create-regexp-features-plugin@npm:7.16.0"
- resolution: "@babel/helper-define-polyfill-provider@npm:0.2.3"
+ resolution: "@babel/helper-define-polyfill-provider@npm:0.3.0"
- resolution: "@babel/helper-explode-assignable-expression@npm:7.15.4"
- resolution: "@babel/helper-function-name@npm:7.15.4"
+ resolution: "@babel/helper-explode-assignable-expression@npm:7.16.0"
- resolution: "@babel/helper-get-function-arity@npm:7.15.4"
- resolution: "@babel/helper-hoist-variables@npm:7.15.4"
- resolution: "@babel/helper-member-expression-to-functions@npm:7.15.4"
- resolution: "@babel/helper-module-imports@npm:7.15.4"
- resolution: "@babel/helper-module-transforms@npm:7.15.7"
- resolution: "@babel/helper-optimise-call-expression@npm:7.15.4"
- resolution: "@babel/helper-replace-supers@npm:7.15.4"
- resolution: "@babel/helper-simple-access@npm:7.15.4"
- resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.15.4"
- resolution: "@babel/helper-split-export-declaration@npm:7.15.4"
+ resolution: "@babel/helper-skip-transparent-expression-wrappers@npm:7.16.0"
- resolution: "@babel/helpers@npm:7.15.4"
- resolution: "@babel/highlight@npm:7.14.5"
- resolution: "@babel/parser@npm:7.15.7"
- resolution: "@babel/plugin-external-helpers@npm:7.14.5"
+ resolution: "@babel/plugin-external-helpers@npm:7.16.0"
- resolution: "@babel/plugin-proposal-class-properties@npm:7.14.5"
+ resolution: "@babel/plugin-proposal-class-properties@npm:7.16.0"
- resolution: "@babel/plugin-proposal-export-default-from@npm:7.14.5"
+ resolution: "@babel/plugin-proposal-export-default-from@npm:7.16.0"
- resolution: "@babel/plugin-proposal-nullish-coalescing-operator@npm:7.14.5"
+ resolution: "@babel/plugin-proposal-nullish-coalescing-operator@npm:7.16.0"
- resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.15.6"
+ resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.16.0"
- resolution: "@babel/plugin-proposal-optional-catch-binding@npm:7.14.5"
+ resolution: "@babel/plugin-proposal-optional-catch-binding@npm:7.16.0"
- resolution: "@babel/plugin-proposal-optional-chaining@npm:7.14.5"
+ resolution: "@babel/plugin-proposal-optional-chaining@npm:7.16.0"
- resolution: "@babel/plugin-syntax-export-default-from@npm:7.14.5"
+ resolution: "@babel/plugin-syntax-export-default-from@npm:7.16.0"
- resolution: "@babel/plugin-syntax-flow@npm:7.14.5"
+ resolution: "@babel/plugin-syntax-flow@npm:7.16.0"
- resolution: "@babel/plugin-syntax-jsx@npm:7.14.5"
+ resolution: "@babel/plugin-syntax-jsx@npm:7.16.0"
- resolution: "@babel/plugin-syntax-typescript@npm:7.14.5"
+ resolution: "@babel/plugin-syntax-typescript@npm:7.16.0"
- resolution: "@babel/plugin-transform-arrow-functions@npm:7.14.5"
+ resolution: "@babel/plugin-transform-arrow-functions@npm:7.16.0"
- resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.14.5"
+ resolution: "@babel/plugin-transform-block-scoped-functions@npm:7.16.0"
- resolution: "@babel/plugin-transform-block-scoping@npm:7.15.3"
+ resolution: "@babel/plugin-transform-block-scoping@npm:7.16.0"
- resolution: "@babel/plugin-transform-classes@npm:7.15.4"
+ resolution: "@babel/plugin-transform-classes@npm:7.16.0"
- resolution: "@babel/plugin-transform-computed-properties@npm:7.14.5"
+ resolution: "@babel/plugin-transform-computed-properties@npm:7.16.0"
- resolution: "@babel/plugin-transform-destructuring@npm:7.14.7"
+ resolution: "@babel/plugin-transform-destructuring@npm:7.16.0"
- resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.14.5"
+ resolution: "@babel/plugin-transform-exponentiation-operator@npm:7.16.0"
- resolution: "@babel/plugin-transform-flow-strip-types@npm:7.14.5"
+ resolution: "@babel/plugin-transform-flow-strip-types@npm:7.16.0"
- resolution: "@babel/plugin-transform-for-of@npm:7.15.4"
+ resolution: "@babel/plugin-transform-for-of@npm:7.16.0"
- resolution: "@babel/plugin-transform-function-name@npm:7.14.5"
+ resolution: "@babel/plugin-transform-function-name@npm:7.16.0"
- resolution: "@babel/plugin-transform-literals@npm:7.14.5"
+ resolution: "@babel/plugin-transform-literals@npm:7.16.0"
- resolution: "@babel/plugin-transform-member-expression-literals@npm:7.14.5"
+ resolution: "@babel/plugin-transform-member-expression-literals@npm:7.16.0"
- resolution: "@babel/plugin-transform-modules-commonjs@npm:7.15.4"
+ resolution: "@babel/plugin-transform-modules-commonjs@npm:7.16.0"
- resolution: "@babel/plugin-transform-object-assign@npm:7.14.5"
- resolution: "@babel/plugin-transform-object-super@npm:7.14.5"
+ resolution: "@babel/plugin-transform-object-super@npm:7.16.0"
- resolution: "@babel/plugin-transform-parameters@npm:7.15.4"
+ resolution: "@babel/plugin-transform-parameters@npm:7.16.3"
- resolution: "@babel/plugin-transform-property-literals@npm:7.14.5"
+ resolution: "@babel/plugin-transform-property-literals@npm:7.16.0"
- resolution: "@babel/plugin-transform-react-display-name@npm:7.15.1"
+ resolution: "@babel/plugin-transform-react-display-name@npm:7.16.0"
- resolution: "@babel/plugin-transform-react-jsx-self@npm:7.14.9"
+ resolution: "@babel/plugin-transform-react-jsx-self@npm:7.16.0"
- resolution: "@babel/plugin-transform-react-jsx-source@npm:7.14.5"
+ resolution: "@babel/plugin-transform-react-jsx-source@npm:7.16.0"
- resolution: "@babel/plugin-transform-react-jsx@npm:7.14.9"
+ resolution: "@babel/plugin-transform-react-jsx@npm:7.16.0"
- resolution: "@babel/plugin-transform-regenerator@npm:7.14.5"
+ resolution: "@babel/plugin-transform-regenerator@npm:7.16.0"
- resolution: "@babel/plugin-transform-runtime@npm:7.15.0"
+ resolution: "@babel/plugin-transform-runtime@npm:7.16.4"
- resolution: "@babel/plugin-transform-shorthand-properties@npm:7.14.5"
+ resolution: "@babel/plugin-transform-shorthand-properties@npm:7.16.0"
- resolution: "@babel/plugin-transform-spread@npm:7.14.6"
+ resolution: "@babel/plugin-transform-spread@npm:7.16.0"
- resolution: "@babel/plugin-transform-sticky-regex@npm:7.14.5"
+ resolution: "@babel/plugin-transform-sticky-regex@npm:7.16.0"
- resolution: "@babel/plugin-transform-template-literals@npm:7.14.5"
+ resolution: "@babel/plugin-transform-template-literals@npm:7.16.0"
- resolution: "@babel/plugin-transform-typescript@npm:7.15.4"
+ resolution: "@babel/plugin-transform-typescript@npm:7.16.1"
- resolution: "@babel/plugin-transform-unicode-regex@npm:7.14.5"
+ resolution: "@babel/plugin-transform-unicode-regex@npm:7.16.0"
- resolution: "@babel/register@npm:7.15.3"
+ resolution: "@babel/register@npm:7.16.0"
- resolution: "@babel/runtime@npm:7.15.4"
- resolution: "@babel/template@npm:7.15.4"
- resolution: "@babel/traverse@npm:7.15.4"
- resolution: "@babel/types@npm:7.15.6"
- resolution: "@humanwhocodes/object-schema@npm:1.2.0"
+ resolution: "@humanwhocodes/object-schema@npm:1.2.1"
- resolution: "@types/node@npm:16.10.2"
+ resolution: "@types/node@npm:16.11.10"
- resolution: "@types/prettier@npm:2.4.1"
+ resolution: "@types/prettier@npm:2.4.2"
- resolution: "@types/react@npm:17.0.26"
+ resolution: "@types/react@npm:17.0.37"
- resolution: "acorn@npm:8.5.0"
+ resolution: "acorn@npm:8.6.0"
- resolution: "ajv@npm:8.6.3"
+ resolution: "ajv@npm:8.8.2"
+ resolution: "aproba@npm:2.0.0"
+ resolution: "are-we-there-yet@npm:2.0.0"
- resolution: "array-includes@npm:3.1.3"
- resolution: "asn1@npm:0.2.4"
+ resolution: "asn1@npm:0.2.6"
- resolution: "babel-plugin-istanbul@npm:6.0.0"
+ resolution: "babel-plugin-istanbul@npm:6.1.1"
- resolution: "babel-plugin-polyfill-corejs2@npm:0.2.2"
+ resolution: "babel-plugin-polyfill-corejs2@npm:0.3.0"
- resolution: "babel-plugin-polyfill-corejs3@npm:0.2.5"
+ resolution: "babel-plugin-polyfill-corejs3@npm:0.4.0"
- resolution: "babel-plugin-polyfill-regenerator@npm:0.2.2"
+ resolution: "babel-plugin-polyfill-regenerator@npm:0.3.0"
- resolution: "big-integer@npm:1.6.49"
+ resolution: "big-integer@npm:1.6.51"
- resolution: "bplist-creator@npm:0.0.8"
+ resolution: "bplist-creator@npm:0.1.0"
- resolution: "bplist-parser@npm:0.2.0"
+ resolution: "bplist-parser@npm:0.3.0"
- resolution: "browserslist@npm:4.17.2"
- resolution: "camelcase@npm:6.2.0"
- resolution: "caniuse-lite@npm:1.0.30001263"
+ resolution: "camelcase@npm:6.2.1"
- resolution: "color-string@npm:1.6.0"
+ resolution: "color-string@npm:1.7.4"
- resolution: "core-js-compat@npm:3.18.1"
+ resolution: "core-js-compat@npm:3.19.1"
- resolution: "csstype@npm:3.0.9"
+ resolution: "csstype@npm:3.0.10"
- resolution: "debug@npm:4.3.2"
+ resolution: "debug@npm:4.3.3"
- resolution: "electron-to-chromium@npm:1.3.857"
- resolution: "eslint-plugin-react-hooks@npm:4.2.0"
+ resolution: "eslint-plugin-react-hooks@npm:4.3.0"
- resolution: "eslint-plugin-react@npm:7.26.1"
+ resolution: "eslint-plugin-react@npm:7.27.1"
- resolution: "estraverse@npm:5.2.0"
+ resolution: "estraverse@npm:5.3.0"
- resolution: "extsprintf@npm:1.4.0"
+ resolution: "extsprintf@npm:1.4.1"
- resolution: "fbjs@npm:0.8.17"
+ resolution: "fbjs@npm:0.8.18"
- resolution: "fbjs@npm:3.0.0"
+ resolution: "fbjs@npm:3.0.1"
- resolution: "flatted@npm:3.2.2"
+ resolution: "flatted@npm:3.2.4"
+ resolution: "gauge@npm:4.0.0"
- resolution: "globals@npm:13.11.0"
+ resolution: "globals@npm:13.12.0"
- resolution: "ignore@npm:5.1.8"
+ resolution: "ignore@npm:5.1.9"
- resolution: "import-local@npm:3.0.2"
+ resolution: "import-local@npm:3.0.3"
- resolution: "is-core-module@npm:2.7.0"
- resolution: "istanbul-lib-coverage@npm:3.0.1"
+ resolution: "istanbul-lib-coverage@npm:3.2.0"
+ resolution: "istanbul-lib-instrument@npm:5.1.0"
- resolution: "istanbul-lib-source-maps@npm:4.0.0"
+ resolution: "istanbul-lib-source-maps@npm:4.0.1"
- resolution: "istanbul-reports@npm:3.0.2"
+ resolution: "istanbul-reports@npm:3.0.5"
- resolution: "lines-and-columns@npm:1.1.6"
+ resolution: "lines-and-columns@npm:1.2.4"
- resolution: "lodash.clonedeep@npm:4.5.0"
- resolution: "make-fetch-happen@npm:8.0.14"
+ resolution: "make-fetch-happen@npm:9.1.0"
- resolution: "makeerror@npm:1.0.11"
+ resolution: "makeerror@npm:1.0.12"
- resolution: "mime-db@npm:1.50.0"
+ resolution: "mime-db@npm:1.51.0"
- resolution: "mime-types@npm:2.1.33"
+ resolution: "mime-types@npm:2.1.34"
- resolution: "mime@npm:2.5.2"
+ resolution: "mime@npm:2.6.0"
- resolution: "nanocolors@npm:0.2.12"
- resolution: "node-fetch@npm:2.6.5"
+ resolution: "node-fetch@npm:2.6.6"
- resolution: "node-gyp@npm:8.2.0"
+ resolution: "node-gyp@npm:8.4.1"
- resolution: "node-releases@npm:1.1.77"
+ resolution: "npmlog@npm:6.0.0"
- resolution: "object.entries@npm:1.1.4"
+ resolution: "object.entries@npm:1.1.5"
- resolution: "object.fromentries@npm:2.0.4"
+ resolution: "object.fromentries@npm:2.0.5"
- resolution: "object.hasown@npm:1.0.0"
+ resolution: "object.hasown@npm:1.1.0"
- resolution: "object.values@npm:1.1.4"
- resolution: "prettier@npm:2.4.1"
+ resolution: "prettier@npm:2.5.0"
- resolution: "prompts@npm:2.4.1"
+ resolution: "prompts@npm:2.4.2"
- resolution: "react-devtools-core@npm:4.19.1"
+ resolution: "react-devtools-core@npm:4.21.0"
+ resolution: "readable-stream@npm:3.6.0"
- resolution: "redux@npm:4.1.1"
- resolution: "shell-quote@npm:1.7.2"
+ resolution: "shell-quote@npm:1.7.3"
- resolution: "signal-exit@npm:3.0.5"
+ resolution: "signal-exit@npm:3.0.6"
- resolution: "simple-plist@npm:1.1.1"
+ resolution: "simple-plist@npm:1.3.0"
- resolution: "socks-proxy-agent@npm:5.0.1"
+ resolution: "socks-proxy-agent@npm:6.1.1"
- resolution: "source-map-support@npm:0.5.20"
+ resolution: "source-map-support@npm:0.5.21"
- resolution: "spdx-license-ids@npm:3.0.10"
+ resolution: "spdx-license-ids@npm:3.0.11"
+ resolution: "string-width@npm:4.2.3"
- resolution: "string-width@npm:4.2.3"
- resolution: "string.prototype.matchall@npm:4.0.5"
+ resolution: "string.prototype.matchall@npm:4.0.6"
+ resolution: "string_decoder@npm:1.3.0"
- resolution: "table@npm:6.7.2"
+ resolution: "table@npm:6.7.3"
- resolution: "tail@npm:2.2.3"
+ resolution: "tail@npm:2.2.4"
- resolution: "tsconfig-paths@npm:3.11.0"
+ resolution: "tsconfig-paths@npm:3.12.0"
- resolution: "ua-parser-js@npm:0.7.28"
+ resolution: "ua-parser-js@npm:0.7.31"
- resolution: "walker@npm:1.0.7"
+ resolution: "walker@npm:1.0.8"
- resolution: "wide-align@npm:1.1.3"
+ resolution: "wide-align@npm:1.1.5"
- resolution: "ws@npm:7.5.5"
+ resolution: "ws@npm:7.5.6"
I can’t find exactly which package caused the issue. Possible reasons:
- The maximum stack size of js engine for iOS is too small for a large project.
- There is some issue in some third party package listed above.
- There is some issue in the recent updates of fbjs, maybe promise.finally polyfill.
Version
0.63.4
Output of react-native info
System: OS: macOS 11.4 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Memory: 1.16 GB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 17.0.1 - /usr/local/bin/node Yarn: 3.1.0 - /usr/local/bin/yarn npm: 8.1.0 - /usr/local/bin/npm Watchman: 2021.10.18.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 13.1/13A1030d - /usr/bin/xcodebuild Languages: Java: Not Found Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps to reproduce
We just build and run a release on iOS devices and get the crash. We haven’t been able to find a minimal reproduce. Maybe someone can help here?
Snack, code example, screenshot, or link to a repository
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 23 (4 by maintainers)
Hello @ranjithOD We had a js files with almost 500 exports. We just split it into 2 separate js files and the issue was resolved. To me it seems to be an important bug in ReactNative core with probably some other implications than just not supporting too many exports. And to find out what was wrong was really hard. It took me days to figure it out.
You may use this command to find files in the current directory with too many exports. But it has false positive, because not all the reported files are going to be actually used in the bundle.
Example output with all files being actually OK:
Is everyone not getting this issue anymore after upgrading @babel/core to latest as mentioned above? We tried to pin our @babel/core version using yarn resolutions, but we are still getting the mentioned issue, and we are only able to fix it by separating large js files into smaller ones.
This is not ideal for us as the files are auto generated using graphql-codgen in our case, so I was wondering if I am the only one stuck with this issue.
This fixed our issues too.
Hi all,
I came across the same issue yesterday. Splitting the exports into separate files as suggested above works around the issue.
Recently, we upgraded Babel (@babel/core) from version 7.8.4 to 7.16.12. I found the following issue on Github https://github.com/babel/babel/issues/14273, in which a similar problem is occurring due to a bug.
The bug was fixed in the most recent version 7.17.7.
Upgrading Babel to this version resolved the issue without the need to split the exports.
Hope this helps!
Thanks mate, I tried it and got just some of the modules from your example, so your example saved me a lot of time investigating them! My crash eventually caused by a third party library - country-state-city - which apparently does not work well on an actual device.
Thanks a lot @halaei! 🙏
Thank you @halaei this really works, it unblocked me for an urgent release.
We work around like this: bigFile.js (containing > 500 exports). So we split on 2 smaller files as needed, that allow us the less impact trough the usages, since we have trough our application:
import * as bigFile from './bigFile';
The new bigFile.js content will be:
const bigFilePart1 = require('./bigFilePart1');
const bigFilePart2 = require('./bigFilePart2');
module.exports = {
...bigFilePart1,
...bigFilePart2,
};
Thanks 🙏 Do you think npm packages in node_modules are also included in this? Because when I search my project files there aren’t that many.
I can confirm, this is the solution 😆 That’s a weird problem in iOS
Update: I found an easy reproduce. Make a js file that exports 1000 constants and import a few of the constants in App.js. The app will crash in iOS release but not in debug.