figwheel-main 2025-03-13

I’ve got my project working mostly the way I want with figwheel and cider. However I have a jetty backend and I can’t seem to figure out how to start that as well when I jack-in. I have a separate jetty server in a server.clj file and I need that to fire up also but I can’t tell how to configure that in cider?

Are you using lein or clj configuration?

clj in this case

I’ve been looking in my deps.edn and various config options for cider in emacs, but it’s just unclear to me if there is a “normal” way to do this or not

So the answer here is to create a .dir-locals.el in your project root. https://docs.cider.mx/cider/config/project_config.html

I do have that, the problem is that only works for starting the front-end server. It won’t / can’t start the backend server as well.

You can inject the call to the backend server. before you call (figwheel.main/start :dev)

Mine looks like this:

((nil
  (cider-clojure-cli-aliases . "-A:fig")
  (cider-default-cljs-repl . figwheel-main)
  (cider-preferred-build-tool . clojure-cli)
  (cider-figwheel-main-default-options . ":dev")))

ie. (cider-register-cljs-repl-type 'local-cljs-repl "(do (require 'figwheel.main) (figwheel.main/start :dev))")

(cider-default-cljs-repl . local-cljs-repl)

It doesn’t seem to let me “put what I want” It disregards anything I put it the aliases and replaces it with build-tool and default-options

cider-register-cljs-repl-type

that creates a new type

and you associate arbitrary code to start the repl

Ok. Yeah, I was hoping to be able to use some of the built in stuff and not need to create my own custom repl type. But I’m not sure there is any other way at this point.

I honestly think this is the easiest

but ... its perhaps easier to cider-jack-in-clj&cljs and start the server in the clj repl

Yeah, it’s not that hard to just start two independently. I was just initially thinking there might be a way to automatically do it.

I'm a bit disappointed that deps.edn can't chain function calls

cause that would be the easiest

yeah true. Well if I end up going the custom route, I’ll post back here. Thanks sir for the help!

👍 1