emezeske/lein-cljsbuild

Trivial change in CLJC file causes recompile of all CLJS files

Open

#457 opened on Jan 19, 2017

View on GitHub
 (0 comments) (2 reactions) (0 assignees)Clojure (153 forks)batch import
Help Wanted

Repository metrics

Stars
 (1,096 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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}

Contributor guide