= Using Other ClojureScript REPLs
:experimental:

While these days most people are using `figwheel` and `shadow-cljs`,
CIDER supports other ClojureScript REPLs as well.
This section of the user manual is dedicated to them.

== Node.js REPL

IMPORTANT: Make sure `node.js` is installed and that the `node` binary
is on Emacs's `exec-path`.

ClojureScript's Node.js REPL is really simple to setup, as it doesn't
require you to fiddle with your project's dependencies. All you need to do is:

. Open some file in your project.
. Type kbd:[M-x] `cider-jack-in-cljs` kbd:[RET].
. Choose the `node` option when prompted about the ClojureScript REPL type you want
to use.

== Weasel

Using https://github.com/nrepl/weasel[Weasel], you can have a browser-connected REPL.

. Add `[weasel "0.7.1"]` to your project's `:dependencies`.
. Type kbd:[M-x] `cider-jack-in-cljs` kbd:[RET] and choose
the `Weasel` option when prompted about the ClojureScript REPL type you want
to use.
. Add this to your ClojureScript code:
+
[source,clojure]
----
(ns my.cljs.core
  (:require [weasel.repl :as repl]))
(repl/connect "ws://localhost:9001")
----
+
. Once connected you can start evaluating code in the REPL and you'll see the results in your
browser.
+
  cljs.user> (js/alert "Hello world!")

Provided that a Piggieback-enabled ClojureScript environment is active in your
REPL session, code loading and evaluation will work seamlessly regardless of the
presence of the `cider-nrepl` middleware. If the middleware is present then most
other features of CIDER will also be enabled (including code completion,
documentation lookup, the namespace browser, and macroexpansion).

TIP: For more information on Weasel you should consult its https://github.com/nrepl/weasel/blob/master/README.md[documentation].

== Boot ClojureScript REPL

`boot-cljs` is another browser-connected ClojureScript REPL, that's targeting the Boot build tool.
Internally, it's powered by Weasel. Let's go over the steps required to use it.

. Add this to your dependencies in `build.boot`:
+
[source,clojure]
----
[adzerk/boot-cljs        "X.Y.Z"  :scope "test"]
[adzerk/boot-cljs-repl   "X.Y.Z"  :scope "test"]
[pandeiro/boot-http      "X.Y.Z"  :scope "test"]
[weasel                  "0.7.1"  :scope "test"]
[cider/piggieback "0.5.3"  :scope "test"] ; not needed for cider-jack-in-cljs
----
+
and this at the end of `build.boot`:
+
[source,clojure]
----
(require
 '[adzerk.boot-cljs :refer [cljs]]
 '[adzerk.boot-cljs-repl :refer [cljs-repl]]
 '[pandeiro.boot-http :refer [serve]])

(deftask dev []
  (comp (serve)
        (watch)
        (cljs-repl) ; order is important!!
        (cljs)))
----
+
. Type kbd:[M-x] `customize-variable` kbd:[RET] `cider-boot-parameters`
and insert `dev`.
. Open a file in your project and type kbd:[M-x] `cider-jack-in-cljs`.
. Connect to the running server with your browser. The address is printed on the terminal, but it's probably `+http://localhost:3000+`.

For more information visit https://github.com/adzerk-oss/boot-cljs-repl[boot-cljs-repl].

== nbb (node.js babashka)

CIDER has built-in support for `nbb`. You can either jack in to an nbb project with `M-x clojure-jack-in-cljs`.

or start its bundled nREPL server:

  $ nbb nrepl-server

and connect to it afterwards using `M-x cider-connect-cljs`.

See the xref:platforms/nbb.adoc[dedicated page] for more details.

== Other Self-hosted REPLs

For all other self-hosted REPLs you can follow the instructions xref:platforms/other_platforms.adoc[here]. This will work fine with any well-behaved nREPL implementation, like those of:

* https://github.com/babashka/nbb[nbb]
* https://github.com/babashka/scittle[scittle]
* https://github.com/BetterThanTomorrow/joyride[joyride]
