hello, I am new to Clojure and figwheel and having trouble using my own server with figwheel-main and cider. Cider-jack-in-cljs works OK. But if I cider-jack-in-clj&cljs I can't get the cljs repl to connect
I've followed the 'your own server' guide in the docs but I am missing a step on how to integrate that with cider, as it recommends starting with the CLI and -i <your clj script to start server>
I've also tried modifying my dev.cljs.edn to add :connect-url of my server, but the connection doesn't work...in the browser console I see that it keeps trying to connect and failing
any tips greatly appreciated, thanks
(note I've also tried starting the clj server first, and then cljs, but same issue)
Also the 'your own server' page of the docs is confusing to me as well. When I run that example with the CLI, I do get a figwheel session on port 9500, and my jetty server starts on port 4000, but they're not connected, i.e. (js/alert "hi") evals in the port 9500 address, and I can't browse to a route served by jetty via port 9500
aha, I think I'm not understanding how this all works at a basic level...https://stackoverflow.com/questions/56782751/how-to-setup-figwheel-main-to-reload-code-served-by-clojure-backend
I think you'll end up with three servers running on different ports: Jetty (web server) which you can view in a browser to see your application, a Clojure nREPL server that your editor will connect to (for eval'ing .clj code) and a ClojureScript REPL server that your editor will connect to (for eval'ing .cljs code)?
I use Calva (and CIDER) and when it jacks into a Figwheel-Main project, it starts all three of those up, and then when I eval code in the editor, it figures out which REPL to send it to for evaluation, so I can dev against the live backend and the live frontend.
(disclaimer: I'm very new to cljs stuff so this is just how it seems to me so far)
I believe that the CLJ and CLJS repl actually are both using the same nREPL server instance typically. They are just different client-connections to it, where the CLJS one has the cljs-repl wrapper stuff applied.
So you have: 1) Your webserver process (if it’s separate) 2) nREPL server used for all the clj/cljs repl connections (this can also be where you start the webserver in (1)) 3) figwheel’s own server for doing the hot reloading (with browser etc) things
holy cow I got it working!
@seancorfield thank you, that's helpful. Also watching your London stream about repl dev was very useful
this was the critical piece, https://clojurians-log.clojureverse.org/figwheel-main/2020-08-04
I just wasn't understanding some config options for figwheel, getting the :connect-url right made it work
wow this is great