figwheel-main

figwheel-main http://figwheel.org
2021-04-29T17:27:35.118200Z

So given a project using Rum, which is managing both backend (clj) and frontend code (cljs) i'm not sure how to manage my cider repls in order to setup the project. Which should be able to eval forms in either context (clj vs cljs). I'm trying to think this through right now, but chime in if you have thoughts. Here is the deps file for the figwheel hello world rum template

{:deps {org.clojure/clojure {:mvn/version "1.10.0"}
        org.clojure/clojurescript {:mvn/version "1.10.773"}
        rum {:mvn/version "0.12.3"}}
 :paths ["src" "resources"]
 :aliases {:fig {:extra-deps
                  {com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
                   com.bhauman/figwheel-main {:mvn/version "0.2.11"}}
                 :extra-paths ["target" "test"]}
           :build {:main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}
           :min   {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "dev"]}
           :test  {:main-opts ["-m" "figwheel.main" "-co" "test.cljs.edn" "-m" "drewverlee.test-runner"]}}}
• We have clojure for the backend and sever code. • clojurescript for the cljs compiler, sense were not doing self hosted Now the docs imply you should run clojure -A:fig:build from the command line. That going to bring in our extra deps, mainly figwheel-main, and the second command is going to run a command in the figwheel.main ns triggering the dev build with a repl. I'm 90% postive the later is the fighweel repl responsible for hot reloading our code, NOT an nrepl i can connect my emacs editor buffer to and eval forms. This seems to align with the fact that cider tells me no repls are available to connect to. Now, if i check the cider docs concerning figwheel, they imply the happy path is just running 'cider-jack-in-clj/cljs' but that's where i start getting confused, because this project is both. Well, we do have a cider-jack-inclj&cljs, but that doesn't seem to "just work". As far as i can tell, the rum setup breaks the nice separation of concerns that cider expects for easy setup. Though i'm sure someone that understands the internals undrstands what should be done here. My hunch is that ill need run cider-jack-in-clj, then start the fighwheel server repl AND start an nrepl server for CLJS. Normally, i would start my CLJS repl via cider-jack-in-cljs. But then what tells the figwheel server to talk to the nrepl server? The docs here are a good place to start https://figwheel.org/docs/editor-integration.html It even has a nice diagram that explains the flow, but how do we actually achieve that in this context?