bhauman / figwheel-main

Figwheel Main provides tooling for developing ClojureScript applications
https://figwheel.org
Eclipse Public License 1.0
640 stars 93 forks source link

Code reloading for Clojure ring code works only with weird configuration #285

Closed danielmarreirosdeoliveira closed 2 years ago

danielmarreirosdeoliveira commented 3 years ago

Hi there, first of all, thanks for writing figwheel. It is really a joy to develop with its help. I encountered something with regard to the ring configuration, which I could not work out properly. This is in the context of a fullstack starter-app, as can bee seen in this branch: https://github.com/danielmarreirosdeoliveira/fullstack-clj/tree/configuration-issue (start via lein fig:build). In a standalone ring application with the lein-ring plug-in I am able to change code, save, and on the next Rest-Query I see that the code changes are active. Now in this fullstack-clj demo I can do the same. I change something in src/clj and changes take effect immediately. However, I think I achieved this probably by accident. What I mean is that in project.clj I have :source-paths ["src" "src/cljs" "src/clj" "src/cljc" "test/clj" "test/cljs"] and in dev.cljs.edn I have :watch-dirs ["test" "src"]. But what I really want is :source-paths ["src/cljs" "src/clj" "src/cljc" "test/clj" "test/cljs"] and :watch-dirs ["src/cljc","src/cljs","test/cljs"], because then source paths point to roots of classpath trees. With this config the backend code reload stops working. Going from that config I can then adjust watch-dirs to ["test","src"] and (correctly) get the warning that "src" is not in the classpath. But the code reloading works again. To test the api, I usually query localhost:9500/api/abc and change the number of ! in src/clj/fullstack/api_main.clj#L11. I can not say, what is going on here, but the goal would be to have no warnings, a clean configuration, as well as backend hot code reload.

danielmarreirosdeoliveira commented 2 years ago

Got it working. Stupid mistake. It should have been clear in any case that the reloading of the ring based clojure backend code could have nothing to do whatsoever with figwheel-main which takes care of the clojurescript code.