plexus / chestnut

Application template for Clojure + ClojureScript web apps
Eclipse Public License 1.0
1.32k stars 99 forks source link

Stop using profile merging for :cljsbuild key. Just use different builds. #172

Closed bhauman closed 8 years ago

bhauman commented 8 years ago

There are several reasons for this.

One reason is :output-dir contamination. Having both compiles go to the same output directory can lead to confusing compilation states when moving from dev to prod.

My main reason is that this is where people look for an example of how to set up a ClojureScript project and (start-figwheel!) can't do profile merging and it ends up confusing a lot of people. There is are several reasons for figwheel not to do profile merging, but the biggest one is so that we aren't pulling all of Leiningen into the process that is running the compiler and possibly the dev server. Leiningen is a big dependency that changes slowly and this can lead to all sorts of dependency tree conflicts.

Another reason is that profile merging is just not needed.

The configuration for :figwheel and :cljsbuild are "just data". They do not change the runtime environment the way that something like :dependencies or something else that modifies the classpath.

And since :cljsbuild lets you have as many builds as you need, there is no need to use profile merging to get the behavior you want.

So it would be extremely helpful if we could change this to use multiple builds in cljsbuild.

plexus commented 8 years ago

I'll try to prepare a pull request, I would very much appreciate if you could have a look at it. A lot of Chestnut is just "this is how I managed to get it working". I've always held that if there's a better way people should tell me. Unfortunately they rarely do. I discovered way too late you can pass :main option to :cljsbuild for example. Once I did it very much simplified dev vs prod.

So, thanks for the feedback. I'll do my best to cook something up.