Hi folks. I've spent several days experimenting trying to get my cljsrn setup working, having tried krell, expo, react-native-figwheel-bridge, and custom hand-made configurations. I keep hitting issues, and I'm pulling my hair out a bit. I have moderate clojure experience, but none with the js ecosystem. I'd appreciate some pointers! I figure expo would be the easiest entrypoint. However:
❯ lein new expo your-project +reagent
Generating fresh Expo project.
README.md contains instructions to get you started.
If you have any questions, you can ask us on Clojurians #cljsrn channel. <http://clojurians.net>
❯ cd your-project
❯ yarn install
yarn install v1.22.10
warning ../package.json: No license field
info No lockfile found.
[1/4] Resolving packages...
warning expo > fbemitter > fbjs > core-js@1.2.7: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native > fbjs > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native > fbjs-scripts > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native > metro-babel-register > core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
warning react-native > @react-native-community/cli > metro > metro-minify-uglify > uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
warning react-native > @react-native-community/cli > metro > jest-haste-map > sane > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-native > @react-native-community/cli > metro > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: <https://github.com/lydell/resolve-url#deprecated>
warning react-native > @react-native-community/cli > metro > jest-haste-map > sane > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see <https://github.com/lydell/urix#deprecated>
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro-react-native-babel-transformer@0.51.0" has unmet peer dependency "@babel/core@*".
warning "react-native > @react-native-community/cli > metro-react-native-babel-transformer@0.51.1" has unmet peer dependency "@babel/core@*".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 11.18s.
❯ lein figwheel
Source maps enabled.
Figwheel: Starting server at <http://0.0.0.0:3449>
Figwheel: Watching build - main
Figwheel: Cleaning build - main
Compiling build :main to "target/expo/index.js" from ["src" "env/dev"]...
Successfully compiled build :main to "target/expo/index.js" in 11.065 seconds.
Launching ClojureScript REPL for build: main
Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild id ...) ;; starts autobuilder focused on optional ids
(switch-to-build id ...) ;; switches autobuilder to different build
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(reload-config) ;; reloads build config and resets autobuild
(build-once id ...) ;; builds source one time
(clean-builds id ..) ;; deletes compiled cljs target files
(print-config id ...) ;; prints out build configurations
(fig-status) ;; displays current state of system
(figwheel.client/set-autoload false) ;; will turn autoloading off
(figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
Switch REPL build focus:
:cljs/quit ;; allows you to switch REPL to another build
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
... and it just hangs, indefinitely.seems this missing figwheel-main.edn was the issue. couldn't see it referenced in any of the guides, though maybe I missed something.
thanks so much!
Glad it works!
When experimenting with react-native-figwheel-bridge, I kept running into issues with Error: Can't resolve './Libraries/Components/AccessibilityInfo/AccessibilityInfo'
and similar. None of the 'out-of-the-box' instructions seem to work for me. Am I doing something horribly wrong?
(figwheel-bridge optionsUrl also cannot be fetched: [Error: Figwheel Bridge Unable to fetch optionsUrl: http://localhost:19001/target/public/cljs-out/android/cljsc_opts.json])
My previous experience was mostly plain clj projects, and am familiar with lein. Plain react native projects have no problem with my setup, launching in the emulator without problems. Am running on Linux.
try shadow-cljs, was extremely easy for me to get a new setup going
I dunno. I tried with shadow-cljs, certainly not intuitive how to get it set up to launch anything in an android emulator. It isn't even mentioned in the user guide.
Trivial to go from 0 to browser REPL, but as for later tooling, official docs seem thin on the ground.
from my recent experience shadow-cljs let me make extremely minimal changes on a brand new app created with react-native's cli tools and there's tons of documentation around how to get things running on simulators there, all works for me
compared to my experience awhile ago when using re-natal, it's enormously easier