We currently use cljsbuild to compile our clojurescript source into the assets used in production (and testing), but during development, we use lein-figwheel. Both cljsbuild and figwheel are constantly watching for changes of the source and recompile when necessary.
I was wondering, whether it’s possible to use just one tool for both, preferably in the same process. We’re fine with switching tools, especially Figwheel Main. Each file change should just compile:
a js with advanced optimizations to be used in production
live reload the code in the browser as figwheel & figwheel main do it
I found this in the figwheel documentation, but it requires manual work like cleaning targets and running the build on demand with special options.
As a data point, figwheel main works great for me to build production assets (along with a short wrapper script that removes target/ just to be safe as you say)
We have some integration tests using RSpec, Capybara & headless Chrome, that also test ClojureScript parts (along with the Rails application). As we want to run them both on CI and locally, it was an easy solution. But maybe we should rethink that.