clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
ag 2021-07-02T06:56:51.136500Z

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?

thheller 2021-07-02T07:12:49.138400Z

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.

ag 2021-07-02T07:23:20.141200Z

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?

thheller 2021-07-02T07:25:44.142700Z

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.

thheller 2021-07-02T07:27:02.143900Z

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

thheller 2021-07-02T07:27:51.144700Z

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

thheller 2021-07-02T07:28:29.145200Z

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

thheller 2021-07-02T07:29:10.145800Z

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

thheller 2021-07-02T07:29:45.146500Z

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

thheller 2021-07-02T07:30:04.146900Z

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)

thheller 2021-07-02T07:35:23.147800Z

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

thheller 2021-07-02T07:35:53.148400Z

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

2021-07-02T09:24:57.153100Z

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)

Apple 2021-07-02T09:56:16.153500Z

sounds like you need to start a cljs repl from editor

Schpaa 2021-07-02T10:03:14.155100Z

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.

Schpaa 2021-07-02T10:04:03.155300Z

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

Schpaa 2021-07-02T10:05:07.155700Z

I am using shadow-cljs

Schpaa 2021-07-02T10:05:32.156Z

Perhaps I need to reinstall the dev-environment

Schpaa 2021-07-02T10:07:45.156600Z

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

p-himik 2021-07-02T10:09:04.156700Z

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

Schpaa 2021-07-02T10:11:12.156900Z

I don’t know what to look for

Schpaa 2021-07-02T10:16:48.157100Z

the error disappeared while just looking at the screen

Schpaa 2021-07-02T10:16:56.157300Z

this is not good

Schpaa 2021-07-02T10:17:21.157500Z

perhaps the machine is defective, memory etc

p-himik 2021-07-02T10:19:29.157700Z

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.

Schpaa 2021-07-02T10:22:13.157900Z

No, this machine has defective memory

Schpaa 2021-07-02T10:22:22.158100Z

just confirmed it

Schpaa 2021-07-02T10:23:24.158300Z

sorry to bother you with this, thanks anyway

p-himik 2021-07-02T10:24:07.158500Z

No problem.

nate sire 2021-07-02T16:27:53.158900Z

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

thheller 2021-07-02T19:46:22.159800Z

> Error: No reader function for tag object

thheller 2021-07-02T19:46:33.160Z

there never is a reader function for #object

thheller 2021-07-02T19:46:45.160200Z

you are trying to parse invalid EDN I guess?

thheller 2021-07-02T19:47:19.160400Z

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