Shadow-cljs and CIDER

clojurescript

#1

Dear community,

as a long-term REPL-user who is actually trying to play with shadow-cljs, I am feeling a bit limited - everything is (maybe due to my lack of knowledge) focusing on save-and-reload behavior (like fighwheel) instead of REPL (recompile changed part in-place).

Is this possible to work in real REPL with shadow-cljs? And even if not, do you know any guide/tutorial about how to work with shadow-cljs and EMACS? I really don’t want to take unnecessary effort taking the wrong road here, fighting with tools instead of using them.

Best regard,
Slawek


#2

The latest version of cider should have support for shadow-cljs.

You may run shadow-cljs node-repl or shadow-cljs browser-repl if you want a REPL-only workflow not tied to a specific build. You can also start these from the CLJ REPL via (shadow/node-repl) or (shadow/browser-repl), assuming (require '[shadow.cljs.devtools.api :as shadow]).

The builds are usually setup to use “autobuild” by default but that can be disabled as well by running (shadow/watch :app {:autobuild false}). Without autobuild file saves will not trigger a recompile and instead you just use the usual REPL stuff, eg. load-file or (require ... :reload) or just manual eval of some forms. There is also a (shadow/watch-compile! :app) which will manually trigger a recompile of all files that were changed since the last full compile.

I personally do not use cider so I cannot give any advice on how to use it with shadow-cljs. I know that many people are using it successfully though. The usual jack-in stuff should work. Might be better supported when going through lein still but I do not know. The docs should have all the basics.


#3

The latest cider have great support for shadow-cljs, you just run cider-jack-in, then manually start the build with (shadow/watch ...) and switch to cljs repl by (shadow/repl ...).