Using Figwheel
Figwheel is one of the most popular ClojureScript REPLs today. Below you’ll instructions how to setup and use it with CIDER.
There are two versions of Figwheel out there - the legacy figwheel and
the modern figwheel-main. You’re
strongly advised to use figwheel-main.
|
Using Figwheel-main
The setup instructions that follow focus on the bare minimum you need to do to get Figwheel to work with CIDER. For more details you should check out Figwheel’s excellent documentation.
Leiningen Setup
This part of the setup is only necessary if cider-inject-dependencies-at-jack-in has
been changed from its default setting of t (enabled), as described earlier.
You’ll also have to configure Piggieback manually if you’re planning to use
cider-connect-cljs.
|
-
Add this to your dev
:dependencies(not needed forcider-jack-in-cljs):[cider/piggieback "0.5.3"] -
Add this to your dev
:repl-options(not needed forcider-jack-in-cljs)::nrepl-middleware [cider.piggieback/wrap-cljs-repl]
Now it’s time to add figwheel-main to your dependencies as well and you’re good to go. Here’s
an example minimal project.clj (sans the optional Piggieback setup):
(defproject example-project "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.1"]]
:profiles
{:dev
{:dependencies [[org.clojure/clojurescript "1.10.339"]
[com.bhauman/figwheel-main "0.2.3"]]}})
You can now verify that everything’s properly setup by running:
$ lein run -m figwheel.main
A browser window should pop open and back in the terminal you should see a REPL
with a cljs.user⇒ prompt waiting to evaluate ClojureScript code.