react-native-workers icon indicating copy to clipboard operation
react-native-workers copied to clipboard

App doesn’t use second packager

Open haggholm opened this issue 8 years ago • 6 comments

I have this issue both with an internal app, and with the example app, after updating react-native.

git clone [email protected]:fabriciovergal/react-native-workers.git
cd react-native-workers/example
npm i && npm i [email protected]
# In separate terminals:
react-native start
react-native start --port 8082
react-native run-android

In no case does anything actually trigger the second packager: both index.android.js and index.worker.js are packaged by the first packager, listening on port 8081. This causes issues when I try to run the debugger: if I launch the Chrome debugger, there seems about a 50-50 chance that it will show the app bundle or the worker bundle, respectively.

haggholm avatar Jul 27 '17 23:07 haggholm

Note: I’m not having this problem with the iOS version of the same internal app (I had some different issues with the example, but since the bug I’m concerned with here doesn’t occur, and I know virtually dick all about Apple development, those aren’t relevant).

haggholm avatar Jul 28 '17 17:07 haggholm

I think i have an issue due to the same thing that you mentioned. I just try the sample code provided in ReadMe and it sometimes works sometimes not. So, did you give up on this library or could you find a way?

hasancanozkan avatar Sep 05 '17 10:09 hasancanozkan

I’ve stopped using this library, so I’m afraid I’m of no further help. (I wouldn’t call it giving up on it, as such—we migrated some functionality to native extensions rather than JS and had no further need for asynchronous JS execution.)

haggholm avatar Sep 05 '17 17:09 haggholm

all right, thanks for the reply!

hasancanozkan avatar Sep 05 '17 17:09 hasancanozkan

I also run into this issue on Android (no issues on iOS) While the single packager works fine for the example app, in my own app it results in strange undefined errors when I try to import third party libraries (such as react-native-sqlite-storage in my case). It seems that there is a related bug causing packager to fail to resolve certain modules in the index.worker.js.

Traviskn avatar Sep 13 '17 22:09 Traviskn

As it turns out, the worker has no access to anything on NativeModules by default on android, they'd need to be configured explicitly. Looking through the Java code it looks like methods are already in place to allow passing in Native Modules, there just needs to be some more wiring put in place when creating the worker

Traviskn avatar Sep 15 '17 18:09 Traviskn