Fork me on GitHub

I've been trying to do something, and not entirely sure why it wouldn't work. I want to run start-figwheel and cljs-repl in my user.clj for when the repl loads. When I do this it just hangs forever (or until it reaches the timeout I've set in repl-settings.) In contrast, if I only run start-figwheel in user.clj then I can manually run cljs-repl without problems. Perhaps interestingly, if I run cljs-repl in user.clj in a future/thread it doesn't do the hanging thing, but since it's in a background thread I can't actually use it.


the best I've come up with is

(ns user
  (:require [figwheel-sidecar.repl-api :as figwheel]))

(defn start []
So the process is lein repl and then (start), but I wonder why it's not possible to just run lein repl somehow and have the start happen.


Aha I think I just figured it out: In dev profile

:main user
In user.clj:
(ns user
  (:require [figwheel-sidecar.repl-api :as figwheel]))

(defn start []

(defn -main []
And then run lein run instead of lein repl.


I have almost exactly the same question (I think). I want to start figwheel from inside my project repl, i.e. I don't want to use lein run -m figwheel.main, I don't need its static file server or anything like that. All I want is to launch my repl as usual (jvm repl, for my server), connect to it from CIDER, and then launch a cljs repl. I don't want reload-on-save behavior also, I just need the usual repl-driven workflow. I would think it has to be the most common setup, but weirdly enough, I can't find anything about how to do that on the figwheel's site.

jcr09:09:54 -- why this strange syntax? It seems very confusing to me to be honest. Why isn't it possible to have just one figwheel.edn file with {:dev {:main my-ns.core, :hot-reload false} ...}, etc?


@just_crashed use the scripting api so that you can start figwheel from the repl


@bhauman yep, I was going through the docs and started reading that page literally just now. Looks like I need piggieback now...


the metadata syntax is so that you can read the file to obtain compiler options unencumbered with figwheel options, this is precisely so that you can use the build file with the -co option in cljs.main


and there are other times when you want to read the file and to get the compiler options only


For those who don't use cljs.main, is it possible to specify the same things in figwheel-main.edn? Looks like it's used only to set the default, global figwheel options, so the answer is no, right?


1. I have :hot-reload-cljs false in my build config, but the cljs is still recompiled when files are changed. I have to call (figwheel.main/stop-builds "dev") manually from the repl. Why is this? Did I misunderstand the purpose of :hot-load-cljs?


2. How do I prevent figwheel's http server from starting? Also, what's the supposed way to integrate figwheel output with my server? Is setting :output-to/:output-dir to resources/public enough? Is it the right way to do it or is there a better way?