Choosing between Figwheel and Shadow CLJS depends on your project's requirements and your personal preference. Both Figwheel and Shadow CLJS are excellent tools for ClojureScript development that facilitate live reloading and provide a smooth developer experience. Here are some factors that may help you decide:
Figwheel
Figwheel is a tool for building ClojureScript applications that provides hot code reloading, a browser REPL (Read-Eval-Print Loop), and other development niceties.
-
Strengths:
- Great integration with the ClojureScript compiler.
- Provides instant feedback by automatically pushing code changes to the browser.
- Has a long history and a large community support.
- Works well with the Leiningen build tool.
-
Use Figwheel if:
- You are already familiar with and/or are using Leiningen.
- You prefer a tool that is tightly integrated with the standard ClojureScript ecosystem.
- You are building a standard web application and don't need Node.js or advanced JavaScript module integration.
Shadow CLJS
Shadow CLJS is another build tool for ClojureScript that aims to provide a simpler and more robust development experience. It is designed to address some of the pain points developers encounter when dealing with npm packages and the broader JavaScript ecosystem.
-
Strengths:
- Makes it easier to interoperate with npm packages and JavaScript modules.
- Provides a unified development and build system without the need to use separate tools like Leiningen or Boot.
- Has built-in optimizations and code splitting features.
- Includes a browser REPL and hot reloading features.
- Can be used for both browser-based and Node.js-based ClojureScript projects.
-
Use Shadow CLJS if:
- You need seamless integration with npm and JavaScript modules, or you're planning on using a lot of JavaScript libraries.
- You want a tool that handles more complex build configurations more easily, like code splitting or targeting multiple environments (i.e., browser, Node.js, and React Native).
- You prefer the ease of configuration offered by Shadow CLJS, which can be a bit simpler for beginners compared to setting up Leiningen and Figwheel.
- You are building a project that targets more than just a browser environment and could benefit from the broader JavaScript ecosystem's libraries and tools.
Personal Preference
Ultimately, the choice might come down to which tool you feel more comfortable with. Both Figwheel and Shadow CLJS offer live reloading and other features to enhance the ClojureScript development experience. If you are new to both, you may want to try setting up a simple project with each tool and see which one you prefer.
Some developers start with Figwheel because it's more established in the Clojure community and later move to Shadow CLJS for its npm integration and ease of use. Others stick with Figwheel because they have existing workflows and tooling that are built around it.
No matter which one you choose, both tools are capable of supporting a ClojureScript-based game, so consider your project's specific needs and your productivity with each tool when making your selection.