Currently, when multiple builds are configured, lein-cljsbuild compiles them all in parallel. This worked with older versions of the ClojureScript compiler, but in recent versions, it causes problems due to the top-level cljs.complier/namespaces atom, which is shared among threads. The problem is that this atom is reset by cljs.closure/build at the beginning of a compiler run, and also updated during that run, and thus multiple threads will see it with various unexpected values.
At best, this problem results in massive amounts of undeclared Var warnings, because one thread may reset the atom while another is checking for undeclared Vars. I haven't seen anything worse than that, but I expect that more subtle problems can occur due to this race.
For now, I am going to make multiple builds run sequentially, to work around this problem.
One option for a more permanent solution would be to spawn Java processes for each build, but that could require quite a bit of memory. Also, a process pool would have to be used to avoid the Java startup slowness that auto mode is designed to avoid in the first place.
Perform multiple builds sequentially.
Closes Issue #96.