Fork me on GitHub
#clojurescript
<
2018-12-31
>
johnj00:12:46

I didn't get his cljs + rollup reference, what was he trying to say there?

johnj00:12:33

that rollup is better than webpack at tree shaking?

heefoo03:12:07

Since JavaScript is single threaded (aside from workers) is there any difference of atom from volatile! ?

leonoel08:12:22

@heefoo yes. volatile! has no support for metadata, validators and watchers. if you don't need those, using it instead of atom will save a few memory bytes and a couple of predictable branches on assign

Kelly Innes21:12:40

Hi! I'm having a ton of trouble getting a CIDER REPL to work with Figwheel in Spacemacs

Kelly Innes21:12:30

Can someone recommend a best tutorial for setting this up, with working code examples? It seems like the Figwheel and CIDER docs are both slightly out of date and refer to each other for updates.

Kelly Innes21:12:39

Even a working project.clj file would be great!

lilactown21:12:23

can you explain what you’re having an issue with specifically?

lilactown21:12:34

if you have configured figwheel correctly, you should be able to just cider-jack-in-clojurescript ( SPC m " by default) and pick figwheel and the name of the build you want to run

Kelly Innes22:12:18

So: I cider-jack-in-cljs

Kelly Innes22:12:50

And it appears that the REPL will start, and then I select either figwheel (old docs?) or figwheel-main (new docs)

lilactown22:12:11

are you using lein-figwheel?

Kelly Innes22:12:05

When I do Ctrl-C, Ctrl-K, it tells me that no REPL exists

Kelly Innes22:12:48

Essentially I'm trying to replicate what I do in a regular Clojure CIDER thing which is... I have something like (+ 1 2) written in a file and I can ctrl-c ctrl-k to eval it

lilactown22:12:40

does it create a cider and nrepl buffer?

lilactown22:12:37

you might even want to remove nrepl & piggieback from your dev dependenciesj

lilactown22:12:54

using cider-jack-in-cljs should inject the appropriate CIDER dependencies for you

Kelly Innes22:12:35

Interesting. Ok, I'll try that out -- most of this was autogenerated from a lein template for a reagent frontend, so there's still some pieces I don't understand.

Kelly Innes22:12:22

So it looks like it started a working CLJ CIDER REPL

Kelly Innes22:12:49

And then there is another buffer that says "nREPL server started on port...." but is non-interactive

lilactown22:12:49

have you loaded your CLJS app in a browser?

lilactown22:12:13

wait, is there a CLJS and a CLJ CIDER REPL?

Kelly Innes22:12:18

Yeah, and I see the figwheel REPL in the tmux pane in which I did lein figwheel

lilactown22:12:33

wait you did lein figwheel?

lilactown22:12:59

if you’re running figwheel already, then you’re not going to run cider-jack-in-cljs

Kelly Innes22:12:02

Yeah, was that a mistake? That is how I've typically been starting the app

Kelly Innes22:12:09

Oh okay. What am I supposed to run instead?

lilactown22:12:36

nothing. cider-jack-in-cljs should start figwheel for you

Kelly Innes22:12:02

Interesting. Ok, so the CLJ REPL is coming from lein probably

lilactown22:12:05

you can connect remotely to the running lein figwheel process if that’s preferable. but they are separate workflows

Kelly Innes22:12:13

Got it -- that makes sense

Kelly Innes22:12:47

So I'll retry by not starting figwheel from the terminal, but doing cider-jack-in-cljs

Kelly Innes22:12:38

! that totally worked. Thanks for explaining this!

lilactown22:12:47

🙂 sure thing! what cider-jack-in-cljs does is (when in a leiningen project): 1. Starts a Clojure REPL via leiningen, injecting piggieback and nREPL dependencies 2. Starts figwheel for building your app 3. Uses piggieback to inject the ClojureScript REPL with the build that you want into the Clojure REPL started in (1)

Kelly Innes22:12:37

Awesome! That makes sense to me. Thanks again for all your help with this! I've been wanting to show off the REPL development with Reagent but couldn't figure out how to get it to work like it was in a Clojure project.

👍 4