Fork me on GitHub

I inherited a project that has functions like this in dev.clj:

(defn start []
  (shadow/watch :app)

(defn stop []
However, my understanding is that restarting the shadow-cljs server should only be necessary if dependencies change. Is that correct? In other words, it would be better to start the shadow-cljs server via npx shadow-cljs server app and then just start/stop the shadow-cljs watcher in the start and stop functions?


I don't know that there's a downside to restarting the shadow-cljs server, though.


@flowthing yes only changing dependencies should require a restart. stop! stops all running watch processes an in turn kills all REPL state/connections


you can still use the embedded server. just don't call stop!


All right, thanks. The way this project is set up is that you're supposed to call lein repl :headless, then connect to the nREPL with your IDE, and then run (start). This way (stop) doesn't kill the REPL.


yeah I do that for my CLJ setups as well


just run shadow-cljs separately


but it is a bit annoying to manage multiple REPL connections


so I understand why some people might prefer dealing with only one connection


Right. I guess the choice between starting the shadow-cljs server from the command line or using the embedded server here is mostly a matter of preference, then?


yeah. I think things are more reliable if you leave shadow-cljs running independently but otherwise things work the same


Gotcha. Many thanks, both for the answers and for shadow-cljs itself!

đź‘Ť 4

Is it possible to switch between connected clients from the cljs repl? Couldn’t find anything in the docs.


@grav not currently no. the web ui at http://localhost:9630 lets you select which client you connect to but that API isn't accesible elsewhere currently


mostly because tools wouldn't use it anyways


the logic currently picks the first connected client


Ok, but the repl accessible via the Web ui isn’t a cljs one?


Oh, the ones for the clients are.


That’s good enough for me - it allows me to delete the caches on the various clients when I mess up 🙂


Btw, I eventually got both iOS and Android to connect to both https and ssl with live-reload and everything. I just needed to explicitly tell iOS to trust my custom root cert, and I needed to setup port forwarding via Chrome DevTools for both https and wss and use localhost from Android.


Being able to inspect both devices directly from IntelliJ would be freakin’ awesome, but at least the repls in Shadow CLJS’ web-ui brings me some of the way 🙂


Hello, i'm trying to use shadow-cljs for writing a ClojureScript script on Node.js I get an error

No such namespace: js
The instructions that got me there: 0. Configure shadow-deps.clj:
{:source-paths ["src"]

 :dependencies []

 :nrepl        {:port 3333}

 {:app {:target :node-script
        :main demo.script/main
        :output-to "out/demo-script/script.js"
        :output-dir "public/js"
        :asset-path "/js"

         {:entries [demo.script]}}}}}
1. shadow-cljs node-repl app:
cli version: 2.8.26  node: v10.9.0
shadow-cljs - server version: 2.8.26 running at 
shadow-cljs - nREPL server started on port 3333
2. Connect to the Remote Configuration nREPL port 3333 in Cursive, open REPL and see this message:
Connecting to remote nREPL server...
Clojure 1.10.0
3. Evaluate (shadow/repl :app) in the REPL
(shadow/repl :app)
To quit, type: :cljs/quit
=> [:selected :app]
4. Evaluate (js/console.log "working?") 5. Receive the error Any idea how to solve this?


I figured something out on this link [shadow-cljs guide by loganpowell]( > For Node development - unlike when targeting the browser - you'll use:

After evaluating that expression I don't get the error anymore, so I guess the instruction #3 should be replaced with this, in the instruction list I've described above.