shadow-cljs and Emacs/Cider integration

Intro

In this post I will cover shadow-cljs, a ClojureScript compiler with focus on simplicity and ease of use.
Grossly simplifying, you can think of it as a cljsbuild and Figwheel replacement.

The main selling point for me was the npm integration, which works out-of-the-box, but there are also other strong advantages.
You can find other selling points in the introduction to the official UserGuide.

NOTE

We will assume you are using a GNU/Emacs or a similar editor flavour with Cider installed. If you have not yet you can quickly install it with:

M+x package-install
cider

We will also assume yarn is used as npm dependency management tool, but npm would work just as fine.

Integrating shadow-cljs and emacs-cider

There are multiple workflows when using shadow-cljs. You could use the command-line tools only, however to get the full interactive development experience use an editor and integrated REPL. This is where cider enters.
Below we will specify the config files needed to get the Emacs-cider and shadow-cljs working together.

Since in this project we will include packages from npm repository, those dependencies need to be in the package.json config file.
If you run yarn init you will get an interactive prompt to help you specify the config.

NOTE

I have not tried it, but it’s quite possible that the lein-npm Leiningen plugin can be used to specify project’s npm dependencies, eliminating the need for maintaining a package.json config file.
Which might be nice.