I'm using krell and seems like after getting rid of expo I got almost everything I wanted working (i don't know why, but even hermes works without es5 mode 🫣) but I have a few questions: 1. on react native reload i got few errors like these
/target/goog/labs/useragent/highentropy/highentropydata.js -> Cannot read property 'HighEntropyValue' of null
/target/goog/useragent/useragent.js -> TypeError: Cannot read property 'isOpera' of undefined
and a few others
Which seems to be reporting some missing JS objects, is it possible to fix it somehow? They gone after I start evaling things inside repl, but still appear every time I call reload from react-native cli
2. If I add js file dependency I need 1) introduce it inside cljs namespace 2) restart repl so it could appear inside krell_npm_deps 3) recompile the app 4) reload js from react-native cli
which is probably ok, but is it possible to optimize? 1) 2) and 4) are not that bad but 3) is taking too long and looks unnecessary given 4?Regarding 2, can be solved by enabling fast refresh and manually updating krellnpm deps, not that bad but could be even better if the errors from 1 won’t appearing on every file save 🙃
1) is Hermes not working without ES5 mode, actually. It’s trying to parse highentropydata.js and failing because there’s an ES6 class declaration in there.
2) When you say you recompile the app in step 3, do you mean rebuild your cljs/js or do you mean recompile the native app in XCode/Android Studio? You shouldn’t need to do the latter if you’re introducing a pure JS dependency, but lots of NPM packages for React Native include native code that has to be built and if you pull one of those, you’ll have to recompile.
Thank you
1. Interesting, I tried to specifically set this config in build.edn
:language-out :es5
but it doesn't change the errors at all
2. Yes, I mean full recompilation on iOS device, but it wasn't with NPM module, it was with js/require on js file in (say, js/require "../js/sample.js"), restarting the repl adds them krell_npm_deps but only with fast refresh enabled they are patched to the device automatically without reinstall
On 1), there’s a bug in the ClojureScript compiler that recently had a PR to fix where some ES > 6 files were not being properly marked for transpilation, and there’s also a merged PR for Closure to properly account for certain filenames. I believe you need both to make Hermes work, and the CLJS fix has been published but we’re still waiting on a Closure fix to be built and sent to Maven, so you’d have to build locally to use Hermes in development now.
(That Closure fix is merged, they just haven’t pushed a new build since then)
I’m not sure what is going on with 2). I know why you need to restart the repl to rebuild krell_npm_deps, but I’m not sure why you’d need to completely rebuild the project. Force-reloading (cmd-R on the iOS simulator, for example) should do it at least.
Also, the Hermes/ES5 issues only come up in development mode, so it’s possible to disable it in dev, but still build Hermes-compliant production builds, so if it’s just a matter of needing the faster startup times, you can do it that way.
Thank you! To see the fix for one I probably could include relevant clojurescript git dep, and I could somehow reference updated closure there, right? For two, interesting, was sure it’s by design because I’ve read it in the https://github.com/vouch-opensource/krell?tab=readme-ov-file#assets--arbitrary-node-library-requires (but wasn’t sure what recompilation here means)
On 1) it’s slightly complicated to build Closure, because they use Google’s build system rather than just being a normal ant/maven library. I have done it (to test out the change for the PR) but I’d have to refresh my memory on how, it’s not as simple as just giving it a github coordinate like you would with most Clojure or Java libs.
On 2), I read that sentence as meaning you need to recompile your ClojureScript project, not your native project. I think I have always just rebuilt my CLJS when doing that, but don’t have an example to hand to prove it.