Welcome! Please see the About page for a little more info on how this works.

+8 votes
in ClojureScript by

As a new clojurescipr dev I would like to know which one is better.

  1. fighweel
  2. shadowcljs

I am relatively new and want to stick to one. Kindly help me with pros and cons on each so that I can make a informed decision. Wishing you great day

3 Answers

+5 votes
by
selected by
 
Best answer

Figwheel-main and shadow-cljs are both excellent projects to work with.

In general terms, which tool to use depends on how you want to build your application.

Use Figwheel-main for purely ClojureScript projects or ClojureScript with some JavaScript libraries (as bundles or cljsjs).

Figwheel-main has fewer moving parts than shadow-cljs and is therefore very simple to learn and work with.

Use shadow-cljs if you base your app development on npm packages and node.js tools. You should also have knowledge of the npm packages you wish to work with and possibly JavaScript to fix bugs in those packages.

Shadow-cljs greatly simplifies working with npm and the node world, however, as there are more pieces involved, there is more to learn. It is highly advisable to read the https://shadow-cljs.github.io/docs/UsersGuide.html and follow it's guidance carefully.

If you are not sure, I would start with Figwheel-main. All the code you write with Figwheel-main project should work in a shadow-cljs project.

by
Note that figwheel does support npm https://figwheel.org/docs/npm.html - not that I've tried using it myself.

Thomas Heller wrote about why shadow is still a better option in his opinion https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html - but I'd be interested to hear view on that from people who do choose figwheel+npm (e.g. dnolen?, mfikes?) over shadow.
by
The :bundle option is for using npm package with figwheel-main.  I didn't go into detail in the original post.

I have not needed to use npm to create interesting ClojureScript applications.  This is the main reason I use figwheel-main (I cannot speak for others).  Figwheel-main just works, is fast to use, I can write ClojureScript and I dont have to deal with dependencies on npm, understand JavaScript or its ecosystem.

If you don't know the npm packages and what they do in detail, then debugging your system seems a lot harder.  So at least some experience of JavaScript and NPM does seem a requirement if using shadow-cljs

Figwheel-main also just works with the editors I use.  I see a lot of people asking questions in slack on how run a shadow-cljs, I think this is because they are not reading the shadow-cljs guide which really should be followed carefully.

Shadow-cljs does an amazing job of making working with npm and its whole eco-system far simpler that it would be without it.

However, not using npm and javascript at all makes things simpler too.
by
Thanks, John! That's a great answer and follow-up and it really helps me too, since I have started dabbling with cljs again and after playing with shadow-cljs in the past I decided to go with figwheel-main this time and avoid npm/js as much as possible -- and your comments really cement what I was feeling as I explored this space again (we last did serious cljs exploration back in 2013/2014 and it was a whole different ball of wax back then!).
+4 votes
by

I have been using figwheel-main for React Native development for a long time (since 2016 or so) and I'm generally very happy with it.

As of last year, the npm package support is also really flawless. You can "yarn add @tensorflow/tfjs". Then simply add a require like:

["@tensorflow/tfjs" :as tfjs]

... and everything just works (At least on React Native + CLJS. I haven't done a browser-based CLJS project recently but I assume it should be the same).

React Native uses its own bundler (called metro) which you MUST use AFAICT, so on React Native you don't get to avoid using an extra tool. One tip I would give in this regard is: if you are to use JavaScript packages, use "yarn" instead of "npm". This should be applicable for both browser and React Native development. Over the years I have had qualitatively superior experience with yarn. There has been many half days lost only to realize via an obscure google search that it was some weird npm-specific problem. Can't recall any significant problems because of yarn.

I haven't used shadow-cljs myself but thheller is constantly a super helpful and knowledgeable participant in the Clojure community. So I assume the quality of the tool is also excellent, and I have also heard good things from people who use shadow-cljs.

0 votes
by

Hey there! Excellent question. Would you be able to provide some additional information? Namely:

  • what kind of work are you looking to do with ClojureScript?
  • What is your experience with ClojureScript?
  • What is your experience with front end web development?
by
Hi,

- I am looking to build realtime SPA dashboards, updating UI as the data changes. data driven dashboards
- I am a clojurescript newbee, just stared a couple of months back due to its awesomeness on data driven approach and reduced source code
- I have been working on react+redux based webapp for past 6 months now.

hope it answers all your questions. Feel free to reach out if you need any further/detailed information
...