- Command line directly (eg. shadow-cljs)
- Custom scripts (scripts/repl.clj, etc)
- Embedded in other tool (eg. lein)
- Embedded in Editor/IDE (eg. cursive, cider, …)
- Other (please comment)
I’m very curious about what people think is the best way to use any build tool for ClojureScript. While
shadow-cljs supports all the modes listed above I’m beginning to wonder if it would be better for the tool to just run standalone and ignore the embedded option? Tools like
lein-cljsbuild might suggest that you always run everything via
lein but I’m beginning to think that this is not worth the trouble.
I’m torn myself since I’m still using the embedded version in an older project and for shadow-cljs itself (since its a CLJ project).
However the standalone version would enable certain optimizations that can’t be done when running in embedded. They need to mess with the Classloader/Classpath and other things that would potentially “destroy” the Clojure Runtime if used for anything else. The goal would be to enable restart-less changing of dependencies, better startup performance due to AOT and possibly other things. Running CLJS and CLJ separately would potentially also remove a whole bunch of dependency conflicts. Any tool is always going to use some dependency that you might also be using for the CLJ side of things. The CLJS compiler also does not benefit in any way from running alongside your CLJ app. The only thing you gain by running CLJS alongside CLJ is that you can run them in the same REPL but I feel that can be solved by better tool integration. Piggieback/nREPL and switching between CLJ/CLJS REPL is already pretty painful (IMHO).
The status-quo is definitely to use things via
lein since Editors/IDEs like Cursive, cider, etc. expect it. They are however mostly built for Clojure and their integration with CLJS often feels second-class IMHO.
I have been toying with this idea of building a GUI for shadow-cljs (CLI interface isn’t going anywhere) since the GUI can simply display information better than a bit of text output in a shell somewhere. Clicking a few buttons or filling out forms is also generally easier than writing a config file by hand.
I think the only reason we are running CLJ/CLJS side-by-side in the same JVM (eg. figwheel, shadow-cljs) is due to developer UX current tools provide. Maybe I’m missing something?