Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ITSecMedia/f5f4d5028074835a0717a447c0401a7b to your computer and use it in GitHub Desktop.
Save ITSecMedia/f5f4d5028074835a0717a447c0401a7b to your computer and use it in GitHub Desktop.
Setting up shadow-cljs cljs REPL in Cursive

Setting up shadow-cljs cljs REPL in Cursive

See

  1. in shadow-cljs.edn:
 ,,,
 :builds {:my-build-id {:output-dir "target/"
                        :asset-path "."
                        :target     :browser
                        ,,,
  1. in terminal:
yarn shadow-cljs watch app

this will:

shadow-cljs - starting via "clojure"
shadow-cljs - HTTP server available at http://localhost:8080
shadow-cljs - server version: 2.8.31 running at http://localhost:9630
shadow-cljs - nREPL server started on port 59334
shadow-cljs - watching build :my-build-id

where :my-build-id is the name I gave to build. Pick your own.

  1. open browser tab looking at http://localhost:8080 from shadow output above.

  2. in cursive:

  • Run -> Run... -> Edit Configurations... -> + -> Clojure REPL -> Remote
  • give it a name, eg. my cljs repl
  • fillout connect to server with nrepl port 59334 from shadow output above. Or, optionally, in newer Cursive, select use port from nrepl file option instead of hardcoding it.
  • select something in context module.
  • click apply
  1. in cursive: run my cljs repl

  2. DO NOT change clj to cljs in REPL dropdown

  3. in REPL eval:

(shadow/repl :my-build-id)

this will change clj to cljs in REPL dropdown.

  1. Done. Now you can send forms from your cljs and cljc files to the REPL.

  2. This REPL error:

No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.

means you browser tab is not connected to shadow's REPL.
To fix it, do this again:

1. open browser tab looking at `http://localhost:8080` from shadow output above.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment