Fork me on GitHub
#cljsrn
<
2022-10-14
>
Omar05:10:42

I had an RN app working over a year ago with RN 0.63.4 and tried to update everything to the most recent version of RN and shadow-cljs I can run the app with default App.js but if I switch to the shadow cljs build I get what looks like a path error:

Error: ENOENT: no such file or directory, open '/home/naomarik/sah/mobile-app/react-native/http:/localhost:8081/app/goog.math.long.js'
    at Object.openSync (node:fs:599:3)
    at Object.readFileSync (node:fs:467:35)
    at getCodeFrame (/home/naomarik/sah/mobile-app/react-native/node_modules/metro/src/Server.js:1028:18)
    at Server._symbolicate (/home/naomarik/sah/mobile-app/react-native/node_modules/metro/src/Server.js:1101:22)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Server._processRequest (/home/naomarik/sah/mobile-app/react-native/node_modules/metro/src/Server.js:458:7) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/naomarik/sah/mobile-app/react-native/http:/localhost:8081/app/goog.math.long.js'                                                                                                                                                                                                                             }                                                                                                                                                                                                                                                                                                                            ERROR  ReferenceError: Property 'Long' doesn't exist, js engine: hermes
The file in question does exist and shadow-cljs compiles successfully.

Omar05:10:46

Hmm, manually fixing the path in index.js output removes the error but still leaves me this:

ERROR  ReferenceError: Property 'Long' doesn't exist, js engine: hermes
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
        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., js engine: hermes
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
        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., js engine: hermes

Omar05:10:24

Looks like everything works fine without hermes

dima13:10:32

Try adding :compiler-options {:output-feature-set :es5} to https://shadow-cljs.github.io/docs/UsersGuide.html#_output_language_options

joshmiller15:10:49

I haven’t had any luck with Hermes. My app doesn’t really benefit from its faster startup time (it’s already imperceptible) so I’ve just disabled it.

Omar00:10:13

Just saw these replies, thanks @U051091NM that works!

Omar00:10:25

@U05224H0W might be worth updating the shadow-cljs docs to include this point in the react native section? I'm not really familiar with the whole build process and this took me a long time to pinpoint disabling hermes, and would have never guessed it was as easy just to set the compiler option to es5 as dima suggested.

thheller05:10:51

I don't use react-native and know nothing about hermes. no clue why setting :es5 would fix anything either. first time I hear about it

Omar06:10:51

i haven't heard of it either, feels like the foundation to build mobile apps is built on a children ball pit and if you leave it for any amount of time you'll come back to pain

☝️ 1
💯 1
lepistane12:01:10

@U051091NM wow... this actually worked xD alright so fun times ahead. How did you figure this one out?

dima15:01:35

@U45SLGVHV on Hermes Language Features page it says they plan to target ES6 with some exceptions and then there is a list of supported and in-progress features so you could see what's missing

👍 2