Shadowcljs is a build tool for ClojureScript. Figwheel-main is a way to add REPL reloading to the browser.
Shadowcljs happens to have its own browser reload mechanisms built in, so no need for anything else like Figwheel-main.
So change some .cljs file, or send something to the REPL, and you need the reloadable tool to call into the ClojureScript compiler to compile the new code back to JS and then swap the page’s JS with the new JS.
This means that any reloadable tool must know how to re-compile your ClojureScript. Re-compiling ClojureScript means knowing about all the dependencies needed for the code being compiled, etc.
So you can see how it becomes non-trivial to separate reloadable tool from build tool.
That’s why a lot of the Figwheel-main config itself is defining build like things.
Now Figwheel-main has to work with lein or tools.deps and standard ClojureScript compiler build configs and tool chains. That can be a disadvantage in that it’s just harder to do what it wants, it has to play nice with all these things.
Shadowcljs is a ClojureScript build tool first and foremost. It knows how to compile and bundle ClojureScript code. Its specialty is letting you use NPM dependencies with ease. It has a lot of auto-magic and useful extras for working with NPM deps. In that regard, it is better than standard ClojureScript with lein or tools.deps. Though newer ClojureScript with webpack support has gotten a lot better at this as well.
Now Shadowcljs being a build tool, also added reloadable features to itself. Since it is in charge of the whole build chain, it’s much easier for it to add browser reloadable functionality.
Ok, so major difference:
- A full ClojureScript build tool specialized in working with NPM dependencies.
- Also includes a browser reloadable feature built in that is perfectly integrated with all its other build features.
- Not a build tool, only a library that lets you add browser reloadable functionality to existing build tools like lein + standard ClojureScript compiler.
- Need to work harder to find ways to fit in with the build tools it supports.
- I think this was the old figwheel, which only worked with lein. Figwheel-main was a rewrite to try and decouple Figwheel from lein so it could be used with tools.deps and boot as well.