1
votes

We currently use cljsbuild to compile our clojurescript source into the assets used in production, 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.

1

1 Answers

0
votes

I recently switched from lein-figwheel to figwheel-main (using Clojure Deps in place of lein). Figwheel-Main is much simpler, easier & better (basically it is "Figwheel 2.0").

Figwheel-Main can be used for both the auto-reloading during development and for compiling a single my-app.js output file for deployment or testing. You can use either :whitespace or :advanced compiler optimization level to get a single static *.js output file. I use :whitespace to generate an output file for standalone testing purposes (in Docker with chrome --headless) or :advanced for the final production build.

As a side benefit, Clojure Deps is better than lein for managing conflicting dependency versions.