bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 209 forks source link

Duplicate cljsbuild behavior around builds not having the same :output-dir #453

Closed bhauman closed 8 years ago

bhauman commented 8 years ago

https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild/config.clj#L125

Multiple builds sharing the same :output-dir directory is not supported and the config validation should prevent this from happening.

At first it looks like sharing an :ouput-dir is a good initial compile time optimization but in reality this increases the chances for loading half compiled and otherwise inconsistently compiled files.

If you want to precompile your shared intial assets to save compile time, write a script to compile and copy them to the individual :output-dir's. This is the proper way to do this.

The idea of precompiling and copying initial set of shared assets could be an interesting feature to consider.

See #452

bhauman commented 7 years ago

Yeah that's not working right. I'll take a look.

Sent from my iPhone

On Jan 4, 2017, at 5:37 PM, Björn Ebbinghaus notifications@github.com wrote:

It still seems to be a bug, when there If you do not specify any output-dir there is no problem.

I added the devcard-test build with a custom output-dir. And Bang!

:builds { :dev {:source-paths ["src"] :figwheel true :compiler {:main "cloko.frontend"}} :test { :source-paths ["src" "test"] :compiler {:main runners.doo :optimizations :none}} :devcard-test { :source-paths ["src" "test"] :compiler {:main runners.browser :optimizations :none :asset-path "cljs/tests/out" :output-to "resources/public/tests/all-tests.js" :output-dir "resources/public/cljs/tests/out" :source-map-timestamp true}}}}) All ClojureScript build config :output-dir parameters should be unique

{:cljsbuild {:builds {:test {:compiler {:main runners.doo :optimizations :none :output-dir ... ^---- }}}}} It took me a while. The Problem is not, that the output-dir of devcard-test isn't unique. If I add a unique output-dir to either dev or test, the problem is solved.

Even if this behavior is intended. The error reason is wrong.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

MrEbbinghaus commented 7 years ago

My bad. The error reason is right. Can't reproduce. Sorry.