For anyone interested your REPL setup can also mostly be achieved with shadow-cljs. Just add thheller/shadow-cljs
to your deps.edn
as normal and start your CLJ REPL as you normally would with the socket REPL. From there you can just call
(require '[shadow.cljs.devtools.server :as server])
(require '[shadow.cljs.devtools.api :as shadow])
(server/start!)
;; switch REPL to CLJS simply via
(shadow/browser-repl)
;; or
(shadow/node-repl)
;; or specific to a build configured in shadow-cljs.edn
(shadow/watch :the-build)
(shadow/repl :the-build)
You only need to worry about npm
once you want to use actual JS dependencies. Since you mentioned re-frame
that would require npm install react react-dom create-react-class
. You don’t need to use the actual shadow-cljs
CLI interface (from npm
). Although that is of course the recommended way to do things.
Note that the above only actually works in a regular Socket REPL. prepl unfortunately has no way to properly “upgrade” a connection from CLJ->CLJS. A prepl you can get via configuring :prepl {:the-build 12345}
but that requires running the watch by other means (usually shadow-cljs watch the-build
) and then connecting to port 12345 separately.
Not sure how well reveal deals with this though, should be fine with the prepl setup.
Built into shadow-cljs is Inspect which you’ll find at http://localhost:9630/inspect-latest by default. Just (tap> something)
in the REPL to see it there. Works for CLJ and CLJS.