Reputation: 1403
I am using monorepo created using Yarn Workspaces which has a react-native project (mobile folder) and a common folder which contains the common files to be shared across projects. Here the mobile project is dependent on common files.
The Android app runs fine in debug mode. When I run in release mode, it crashes as soon as it opens. I am getting the below error.
E/ReactNativeJS: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
--------- beginning of crash
2022-06-07 23:48:09.865 5772-5799/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.myapp.mobile, PID: 5772
com.facebook.react.common.JavascriptException: TypeError: t is not a function. (In 't(u)', 't' is undefined), stack:
<unknown>@460:2846
map@-1
<unknown>@460:2825
N@457:7733
<unknown>@455:172
h@2:1585
<unknown>@453:262
h@2:1585
<unknown>@403:148
h@2:1585
<unknown>@6:57
h@2:1585
d@2:958
global code@529:3
at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
at java.lang.Thread.run(Thread.java:923)
While researching about this, I came across this suggestion and tired it. Found out that the functions which I import from common is causing this error. It is present in node_modules
but not sure whether it is getting packed into the bundle or not.
Any Suggestions?
Upvotes: 0
Views: 318
Reputation: 1214
I think you should change the import flow the way you are importing the package in your package.json file.
See the example below of the react-native-image-crop-picker importing the library in their example code.
And the library code is in the same parent directory.
Upvotes: 0