emezeske / lein-cljsbuild

Leiningen plugin to make ClojureScript development easy.
Other
1.1k stars 152 forks source link

Trivial change in CLJC file causes recompile of all CLJS files #457

Open mtruyens opened 7 years ago

mtruyens commented 7 years ago

In a fairly large project I am working on, I have a separate source folder with .CLJC-files that are shared between the frontend (Clojurescript) and backend (Clojure).

I noticed that making a trivial change in a CLJC file (e.g., adding a blankline) causes all or most of the CLJC + Clojurescript files to be rebuilt. (See my question on http://stackoverflow.com/questions/41729871/changing-one-cljc-file-causes-full-recompile)

After further investigation, it appears that this problem is not caused by the specifics of my project, but is instead the way lein-cljsbuild intends to operate, to err on the side of safety. (see also https://github.com/emezeske/lein-cljsbuild/issues/345)

Even so, the end result is almost unworkable for me, because trivial changes to CLJC-files cause 45-second builds.

Wouldn't it be a good idea to add an option where the user can specify which (sub)folders in the source code contain "safe" CLJC files? Or, alternatively, an option to treat changes to CLJC-files as changes to CLJS-files (= only recompiles of directly impacted CLJS files), instead of changes to CLJ files (= fully codebase recompiles)?

Figwheel uses a similar configuration option:

:reload-clj-files {:clj true :cljc false}