Fork me on GitHub

I need to add to an existing Clojure (lein) app, a Clojurescript layer. It's been a while since I used Cljs. What's the "recommended" production-ready level approach these days? - Shadow or Figwheel? - If the answer is Shadow, is it better first to convert the lein app to deps.edn? - It's important for me to have two REPLs simultaneously (clj & cljs). Most in my team use CIDER. What do I need to do to be able to just jack-in and have two REPLs?


shadow or figwheel is really your choice. both work. for shadow-cljs you can use lein, deps.edn or keep CLJS completely separate in shadow-cljs.edn. really up to you. Can't comment on Cider but I assume it can connect to a remote REPL even if jacked-in to another CLJ process. shadow can also run embedded into your regular CLJ server although I don't recommend doing that.


Last time I tried shadowcljs, I couldn't figure out that aspect - two REPLs at the same time with CIDER. What are the current cons of using Figwheel? Having to deal with cljsjs packages? > shadow can also run embedded into your regular CLJ server although I don't recommend doing that. Could you tell more, why? Or it's too big of a conversation for Slack?


embedding usually ends up in more dependency conflicts than necessary. for example a common one is guava. the closure-compiler depends on a specific version and having datomic on your classpath as well usually ends in a conflict. There is really no reason to have datomic (and its deps) on the classpath when compiling CLJS.


there are also common issues when running tools.namespace and letting that "refresh" too much and unloading parts of the running shadow-cljs instance


IMHO you gain only pain by running it embedded but you can if you don't mind taking some extra precautions regarding conflicts and so on


(the guava conflict for example also happens with figwheel so not really shadow-cljs specific on that one)


can't comment much on the figwheel side of things. if you only use react+react-dom many people actually prefer sticking with CLJSJS since they don't have to deal with npm


with shadow-cljs you must use npm packages but you also gain access to all of them not just the subset available via cljsjs


but you can also use :target :bundle with figwheel which gives you the same access to npm (at the cost of having to deal with webpack or so)


as for the REPL I use Cursive and just connect remotely to my lein repl using the .nrepl-port file and then remotely to shadow-cljs using the .shadow-cljs/nrepl.port file


works perfectly fine. I'd assume cider can do something similar. no clue about the whole jack-in business though, never done that.


I’m using shadow-cljs with cider, and when I eval a print, it’d print the result in my browser repl, which is fine and expected. But is there anyway to also let it print in cider repl as well? (Sometimes i don’t want to switch to browser-repl and back to editor this case)


sounds like you need to start a cljs repl from editor


How can I solve an “Error: No reader function for tag object.” Where do I even start looking? I’ve remove all caches, all build-products, even rolled back commits, but this message persists in the console and thats all.


main.js:1552 Error: No reader function for tag object. at new cljs$core$ExceptionInfo (core.cljs:11472) at Function.eval [as cljs$core$IFn$_invoke$arity$3] (core.cljs:11504) at Function.eval [as cljs$core$IFn$_invoke$arity$2] (core.cljs:11502) at Function.eval [as cljs$core$IFn$_invoke$arity$variadic] (errors.cljs:37) at Function.eval [as cljs$core$IFn$_invoke$arity$variadic] (errors.cljs:43) at Object.cljs$tools$reader$impl$errors$throw_unknown_reader_tag [as throw_unknown_reader_tag] (errors.cljs:221) at cljs$tools$reader$edn$read_tagged (edn.cljs:372) at cljs$tools$reader$edn$read_dispatch (edn.cljs:72) at Object.cljs$tools$reader$edn$read_delimited [as read_delimited] (edn.cljs:174) at cljs$tools$reader$edn$read_map (edn.cljs:194) env.evalLoad @ main.js:1552 (anonymous) @ main.js:2368


I am using shadow-cljs


Perhaps I need to reinstall the dev-environment


The compiler compiles without any complaints, but this error persists!?!


I would try looking at that place in main.js. Something is trying to read EDN, and that EDN contains #object for some reason.


I don’t know what to look for


the error disappeared while just looking at the screen


this is not good


perhaps the machine is defective, memory etc


Doubt it. I'd wager on some implicit reliance on something indeterminate. Try changing your shadow-cljs build config so is has :devtools {:loader-module nil}. It should create multiple JS files during development instead of a single file with a lot of evalLoad statements. It will be easier to debug that.


No, this machine has defective memory


just confirmed it


sorry to bother you with this, thanks anyway


No problem.

nate sire16:07:53

how did you know to infer it was a memory error? Interested because I recently dealt with a different memory problem.


> Error: No reader function for tag object


there never is a reader function for #object


you are trying to parse invalid EDN I guess?


somewhere in the EDN you are parsing you have a #object [Some.Class ...]