Connect to figwheel REPL

Problem

How to connect a REPL client to the same REPL started by Figwheel, in order to access the same environnment than the one powering the browser.

Solution

Given figwheel is started in a terminal. Spitting out something like:

Figwheel: Starting nREPL server on port: 7888

Connect from a terminal

Then connect to the server from another terminal:

lein repl :connect

and access to the clojurescript REPL, first

(use 'figwheel-sidecar.repl-api)

then

(cljs-repl)

You are now ready to drive your app displayed in the browser. Let's try to print to the browser console

cljs.user=> (js/console.log "hello from the repl")

print_to_console.png

Connect from Vim

Fireplace plugin must be installed. Open vim, it should automatically :Connect to the nREPL server.

Then access to the clojurescript REPL with the command:

:Piggieback (figwheel-sidecar.repl-api/repl-env)

Source

Works the same as before, try cqc to eval some clojurescript in the same context as the browser.

\o/



last updated july 2018