Radu Varga
Radu Varga

Reputation: 2965

cljc file not hot reloading for clojure

I recently implemented my first ".cljc" file that is supposed to bridge between clojure and clojurescript. All went well, also figwheel is picking up the changes and nicely refreshes the new code, however in the clojure side the file is not hot-reloaded.

I'm using the usual

[ring.middleware.reload :refer [wrap-reload]]

in my development middleware.

In my project.clj, I have:

 :source-paths ["src/clj" "src/cljc"]

Any ideas?

Upvotes: 1

Views: 170

Answers (1)

Scott
Scott

Reputation: 17257

Make sure that source paths for both .clj and .cljc files are set at the top level in project.clj for the JVM compilation:

:source-paths ["src/clj" "src/cljc"]

And for the ClojureScript side, ensure that source paths are set anywhere that you have compilation directives for Figwheel e.g.:

; this might be your from your dev profile cljs config:

   :cljsbuild
   {:builds
    {:app
     {:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"]
      :compiler
      {:main "my-project.app"
       :asset-path "/js/out"
       :output-to "target/cljsbuild/public/js/app.js"
       :output-dir "target/cljsbuild/public/js/out"
       :source-map true
       :optimizations :none
       :pretty-print true}}}}

Sounds like your Figwheel config is good, though.

Upvotes: 1

Related Questions