I talked about this one with Brandon Bloom in #clojure and he figured out the issue. He asked me to open this issue, but I am utterly unclear on what the actual problem is, so I'm just going to provide the info he told me to provide along with what he said and hope for the best.
The problem began when I added a second file to a little project I was doing, targeting nodejs. I started getting this:
var c = a.cljs$lang$maxFixedArity;
TypeError: Cannot read property 'cljs$lang$maxFixedArity' of null
at cljs.core.apply.b (/Users/anthony/code/refh/refh.js:5478:14)
at cljs.core.apply.a (/Users/anthony/code/refh/refh.js:5520:18)
at Object.<anonymous> (/Users/anthony/code/refh/refh.js:12328:17)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Brandon had me open up the output file and look at the line.
cljs.core.apply.call(null, cljs.core.STAR_main_cli_fn_STAR, cljs.core.drop.call(null, 2, cljs.nodejs.process.argv));
The problem is that this code comes before the code that actually sets the main-cli-fn.
[17:28:59] <bbloom> oh DUH. i know the issue!
[17:29:31] <bbloom> your file is being compiled
[17:29:32] <bbloom> not run
[17:29:45] <bbloom> then that's going into a big bag of namespaces
[17:30:00] <bbloom> which are being compiled, not run
[17:30:32] <bbloom> so it's not compile order, it's execution order
[17:30:43] <bbloom> nodejscli is being executed before the code that sets the main fn
I have a small branch on Github that should provide a reproducible case. It uses lein-cljsbuild with simple optimizations. Give 'lein cljsbuild once' a shot. https://github.com/Raynes/refh/tree/cljs