I use shadow-cljs with a react native target, put part of my shadow-cljs.edn
at the bottom of the post.
I use reagent, however sparingly, because I’m building a game (you can see more here if you’re interested: https://www.reddit.com/r/animalcapital/comments/f0sa36/new_demo_version_up/).
The libraries I utilize the most is expo-three
and three.js
. I have played around with “just” shadow-cljs + reagent as well though. Works surprisingly well.
Source mapping works great, I haven’t done any config for it, shadow-cljs handles it.
I’ve verified it working for android, ios and web, so I’m happy with it overall.
The app is pretty big. 4mb code atm. I don’t know if this would be lower if I could set :optimizations :advanced
, but I haven’t gotten it to work with three.js (no problem with just reagent, if memory serves). It’s not that big of a deal though, since it’ll be distributed through app store/google play/steam. So I don’t think my game is as size sensitive as other apps.
I haven’t tried expo web:build
with a smaller project, so can’t answer that. Have mostly tried expo for app development.
No spikes, currently building (5-10 minutes in), ram is at 1.24gb atm. But very flat. Not sure how I’d see swap, but disk usage is just 27 written and 53 read so far. Am on MacOS.
Here’s the shadow-cljs.edn. What’s important to note is that I’ve set :autobuild false
, and this is because if you run expo start
– no worries, code reloading works as expected. However, when running expo build --web
, whenever I save a .cljs-file (and shadow-cljs builds it), metro/webpack starts packaging the new js-code (that shadow-cljs will already have loaded…) and then restart the whole app. I’ve spent hours trying to disable this metro/webpack-behaviour, but haven’t had any luck so far. So instead I disable autobuild, and use load-file
in the repl. Works well for me.
{:target :react-native
:init-fn test.app/init
:compiler-options
{:optimizations :simple}
:dev {:external-config
{:devtools/config
{:features-to-install [:formatters :hints]
:fn-symbol "F"
:print-config-overrides true}
:closure-defines {'goog.DEBUG true}
#_#_:guardrails {}}}
:release {}
:output-dir "app"
:devtools {:autobuild false
:repl-pprint true
:repl-init-ns test.game
:preloads [shadow.expo.keep-awake]}}