Fork me on GitHub

I’m trying to build a clojurescript task as part of an uber task, but I’m struggling to come up with a solution which feels fully integrated with . I was hoping/expecting to use in my build script, but I don’t see any concept of a basis there as is found in . So I don’t see a compile-cljs analog to which operates on a basis . Therefore, I don’t see a clear way to specify the needed classpath for the build. Instead, I’ve ended up shelling out to a new process which can get the correct classpath. But, my solution doesn’t feel fully integrated. Am I missing something? Here is what I’ve got (I’m using Figwheel here, but would be just as happy for a release build using a cljs compiler): deps.edn

:figwheel-release {:extra-deps {com.bhauman/figwheel-main {:mvn/version "0.2.15"}}
                              :main-opts ["-m" "figwheel.main"
                                          "--build-once" "release"]
                              :extra-paths ["client/src" "resources"]}
(defn cljs [_]
  (b/process {:command-args ["clojure" "-A:figwheel-release"]}))
{:main ___
 :output-to "___"
 :output-dir "___"
 :optimizations :advanced}


@sashton You can create a java process which invokes cljs.main with args`"-m" "clojure.main" "-m" "cljs.main"`


and this java process takes a basis argument.


but you can also just shell out to clojure and call cljs.main like that


this would be similar for invoking shadow-cljs


Is there a way to do it without shelling out?


you are starting a new process either way, compile-clj is also starting a new clojure process


yeah, that’s true. I guess I was interested in an api which already handles error codes, etc. It seems like a little boilerplate to handle it in each build file, rather than via an api call. I guess I’m wondering: if this isn’t already a feature, is it something someone is considering/working on?


I could certainly roll my own compile-cljs, but I wanted to check if there was already something like that out there

Alex Miller (Clojure team)19:12:25

I would be happy to have a contribution towards that


If I come up with something workable, I’ll reach back out to you about it

Alex Miller (Clojure team)20:12:31

Or maybe it makes sense as a separate lib, not sure

Alex Miller (Clojure team)19:12:43

There is not anything I'm aware of


user=> (def j (b/java-command {:main-args ["-e" "(+ 1 2 3)"] :basis (b/create-basis {}) :main 'clojure.main }))
user=> (b/process (assoc j :out :inherit :err :inherit))
{:exit 0}


but then use :main-args ["-m" "cljs.main"] instead


Ok, I’ll explore that idea.


Thanks for the suggestions!