For regular Clojure projects, the information above should be enough for all situations. For ClojureScript however it’s rare that you would be developing without figwheel, it’s not an edge case, it’s the norm. If you start up a browser prepl though that’s going to launch another tab to evaluate in, it doesn’t share the same context as figwheel.

Thankfully there’s a way to have figwheel reloading your ClojureScript as well as prepl into that figwheel environment! I got this working with figwheel-main and a few tips from Bruce himself over Slack and Twitter (@bhauman). Here’s a minimal deps.edn for this technique.

{ :paths [ "src" "target" ] :deps { org.clojure/clojure { :mvn/version "1.10.0" } org.clojure/clojurescript { :mvn/version "1.10.520" } com.bhauman/figwheel-main { :mvn/version "0.2.0" }}}

And a small amount of code to start up figwheel then hook the prepl into figwheel’s repl-env . This means you can send code to the socket prepl but it’ll rely on figwheel for compiling that ClojureScript and getting the resulting JavaScript into the browser (or node process!) for evaluation.

( ns pfig.main ( :require [ figwheel.main.api :as fig ] [ clojure.core.server :as server ])) ( defn -main [] ( figwheel.main.api/start { :id "dev" :options { :main 'pfig.test } :config { :watch-dirs [ "src" ] :mode :serve }}) ( println "=== START PREPL" ) ( server/start-server { :accept 'cljs.core.server/io-prepl :address "127.0.0.1" :port 6776 :name "pfig" :args [ :repl-env ( fig/repl-env "dev" )]}) ( fig/cljs-repl "dev" ))