Thanks, @bhauman! I tried with cljs.main, and it delivers fast recompiles:
$ clj -M:figwheel -m cljs.main --compile-opts env/figwheel/resources/cljsmain-all.edn --watch src/cljs --watch src/cljc --compile
[...]
Copying file: [lots of files...]
... done. Elapsed 27.26382128 seconds
Watching paths: /Users/martin/c/v/foo/src/cljs, /Users/martin/c/v/foo/src/cljc
Change detected, recompiling ...
Compiling /Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc to target/cljsbuild/public/js/foo/views/home_page.js
Copying file:/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc to target/cljsbuild/public/js/foo/views/home_page.cljc
... done. Elapsed 4.864356377 seconds
One other thing I just tried is to go back to Leiningen for figwheel-main, which is what the rest of my project uses. Maybe there was an impedance mismatch there between the different profiles and aliases. Leiningen is black magic to me, but as I long as I provide enough bat wings and secret incantations it does in fact work.
With the same setup as before, but running under Leiningen, I now got this:
[Figwheel:FINE] Detected changed cljs files: ("/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc")
[Figwheel] Compiling build all to "target/cljsbuild/public/js"
[Figwheel] Successfully compiled build all to "target/cljsbuild/public/js" in 482.354 seconds.
[Figwheel:FINE] Reloading clj files: ("/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc" "/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc")
[Figwheel:FINE] Detected changed cljs files: ("/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc" "/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc")
[Figwheel] Compiling build all to "target/cljsbuild/public/js"
[Figwheel] Successfully compiled build all to "target/cljsbuild/public/js" in 6.114 seconds.
[Figwheel:FINE] Reloading clj files: ("/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc")
[Figwheel:FINE] Detected changed cljs files: ("/Users/martin/c/v/foo/src/cljc/foo/views/home_page.cljc")
[Figwheel] Compiling build all to "target/cljsbuild/public/js"
[Figwheel] Successfully compiled build all to "target/cljsbuild/public/js" in 5.835 seconds.
Notice that the first re-compile takes a long time, while the next two takes a few short seconds.By the way, hot reloading does work with :modules
, for me at least (provided the recompile finishes).
@msolli this is interesting, I think the aot-cache is what is happening here
figwheel disables it because it can cause big headaches. if you enable the aot-cache I think your compile times will be fixed up
there compile times should be the same for all of these setups