vouch-opensource / krell

Simple ClojureScript React Native Tooling
Eclipse Public License 1.0
674 stars 37 forks source link

Hermes needs to be disabled #153

Open kawpuh opened 11 months ago

kawpuh commented 11 months ago

In newer version of react native, Hermes is enabled by default which will result in errors like the following:

 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/dom/tagname.js [SyntaxError: 9:20:Invalid expression encountered]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/html/safescript.js [SyntaxError: 14:1:invalid statement encountered.]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/html/trustedresourceurl.js [SyntaxError: 17:32:Invalid expression encountered]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/html/safeurl.js [SyntaxError: 16:21:Invalid expression encountered]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/html/safestyle.js [SyntaxError: 14:23:Invalid expression encountered]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/html/safestylesheet.js [SyntaxError: 17:1:invalid statement encountered.]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/html/safehtml.js [SyntaxError: 25:22:Invalid expression encountered]
 ERROR  Could not evaluate http://192.168.1.241:8081/target/goog/math/long.js [SyntaxError: 11:1:invalid statement encountered.]

I suggest making a note of this and adding a link to these instructions in the reagent tutorial.

jeisses commented 11 months ago

I ran into the same issue, and disabling Hermes solved it for me as well. Thanks for sharing this :+1:

When using advanced compilation it is possible to enable Hermes again

nsadeh commented 11 months ago

It should be possible to define :language-out :es5 for the compiler so that this isn't an issue. @jeisses how do you re-enable hermes for advanced compilation? Manually?

jeisses commented 11 months ago

Yes manually, which is not great. I also switched to setting :language-out :es5 which is more convenient. Wonder if there are any downsides with switching to es5

nsadeh commented 11 months ago

Sorry I am new to clojurescript builds and haven’t figured out where to put that setting. I put that in build.edn but still get errors, is that the right place?

kawpuh commented 11 months ago

At least for android, instead of manually switching you could add --extra-params=-PhermesEnabled=false to your npx react-native run-android command for debug builds. You can read more about it here. It seems to take precedence over the hermesEnabled property in gradle.properties

kawpuh commented 7 months ago

I've seen talk of adding :language-out :es5 to build.edn as an alternative, but this doesn't seem to work for me. If anyone has an alternative work around for using hermes with krell debug builds it would be nice to know as react-native-reanimated has problems with JSC. EDIT: It seems to be an issue with re-frame-http-fx in particular. If you're not using this library you may be able to get by with just adding :language-out :es5 to build.edn and removing your target folder before recompiling.