Fork me on GitHub
#shadow-cljs
<
2020-02-25
>
markx01:02:40

Looks like in ClojureBridge they still use figwheel instead of shadow-cljs. Anyone know why people would choose figwheel?

markx06:02:02

Because shadow-cljs is better? I myself can’t think of any reason to choose cljsbuild and figwheel, so I’m curious. Let me rephrase my question, nowadays what advantage does figwheel (or maybe cljsbuild and all the cljsjs stuff) have over shadow-cljs?

EmmanuelOga01:02:46

both are great tools

lilactown02:02:25

Same reason people still use lein even though deps.edn exists. People have tools that work really well for them; why change?

Quest04:02:36

I've switched from figwheel & lein to shadow-cljs and deps.edn in the last year. shadow-cljs provides significantly faster compile time but can be harder to get working with Emacs CIDER. One of the biggest reasons I was willing to try switching was thheller's top notch support in this channel. No regrets, though the compile time is the main benefit I've seen so far. On deps.edn vs lein... the startup time is the only real benefit I've realized yet, but there's some interesting things you can do with deps.edn. Just haven't needed them. It was a much harder switch than figwheel -> shadow-cljs though.

dpsutton04:02:48

what problems have you found with CIDER?

Quest04:02:08

Biggest wall I hit was trying to use deps.edn to "wrap" shadow-cljs. Your startup invocation becomes clj -A:shadow-cljs watch app, but I couldn't find a way to get that working with cider-jack-in-cljs

Quest04:02:16

I ended up just sticking with cider-jack-in-cljs + shadow-cljs , but my automation uses the clj -A:shadow-cljs release app alias to release the app as it avoids needing a docker image that has shadow-cljs installed

Quest04:02:46

(The reason I needed deps.edn in the first place was to authenticate to a private maven2 repo)

dpsutton04:02:03

use a prefix to edit the jack in command and type whatever you want

dpsutton04:02:25

C-u C-c M-J and then just type in clj -A:shadow-cljs watch app

Quest04:02:43

I did mess around with that but could never quite get CIDER working. I suspected it had to do with the dependency injections or initialization hooks that CIDER does when running via clj vs shadow-cljs

Quest04:02:08

I'll poke it real quick and see what error comes out, already deleted my previous logs

dpsutton04:02:54

if you can get a minimal example without any sensitive stuff i can poke around. I think bozhidar is working on cljs support and i want shadow to be first class in CIDER

Quest04:02:33

That's generous of you, thank you. I'll setup a public repo to demo this and get back to you tomorrow.

dpsutton04:02:48

ping me with it in #cider and i'll check it out

👍 4
markx06:02:02
replied to a thread:why not?

Because shadow-cljs is better? I myself can’t think of any reason to choose cljsbuild and figwheel, so I’m curious. Let me rephrase my question, nowadays what advantage does figwheel (or maybe cljsbuild and all the cljsjs stuff) have over shadow-cljs?

markx07:02:04

Ha guess I’m not the only one with this question.

Saikyun07:02:28

I didn't get far with figwheel, but from my experience shadow-cljs solves every problem I've ran into in a clean way: • dev http server • can run clojure code (as opposed to lumo et al) • repl ALL THE TARGETS • fantastic integration with npm packages since I personally prefer repl + load file / eval-defun, I'm finding shadow-cljs a lot faster to use than figwheel, which seems dependent on "hot reload" rather than eval

markx07:02:24

Yeah I know! That’s why I’m asking.

markx07:02:12

I wish shadow-cljs was the default solution, and people advertise it as the default solutiton.

Saikyun07:02:25

I guess one would have to ask in the #figwheel what they like about it, that they don't think shadow-cljs solves 🙂

Saikyun07:02:56

I guess one could say that figwheel only solves one problem. I do however agree that I'd personally recommend shadow-cljs over figwheel. doesn't mean that figwheel is bad though 🙂

Saikyun07:02:18

I think if you come from another programming language, maybe figwheel is easier to get started with? the docs for shadow-cljs are pretty intimidating 😄

zilvinasu07:02:42

There is an npm starter script you can use to generate shadow-cljs project (`npx create-cljs-project your-projec` )

markx07:02:50

I came from a js+go+python background. I think figwheel and all the cljsbuild stuff are intimidating

Saikyun07:02:50

sure, but that doesn't mean that it's easier to comprehend the tool 🙂 when you come from another language, you're generally used to very sparse tooling (`compile-binary source.ext`), so regardless of which tool you choose, it's going to feel like a lot. and shadow-cljs solves so many problems, so might be figwheel feels easier to get started with

Saikyun07:02:56

this is purerly conjecture on my part

Saikyun07:02:18

haha, I see 🙂 I got interested in cljs because of the nice figwheel youtube intro

Saikyun07:02:08

it was very easy to understand what problem figwheel solves

Saikyun07:02:21

maybe one ought to make a similar video for shadow-cljs? 🙂 looking here it's not immediately clear what problem shadow-cljs solves: http://shadow-cljs.org/

Saikyun07:02:27

just some thoughts ^^

lilactown15:02:23

Does shadow-cljs automatically load user.cljs if it’s on the classpath?

lilactown15:02:05

I’m trying to write instructions for how best to include some code only at dev time. I think you could either put it in user.cljs, or put it in a preload

thheller17:02:11

use a prelaod always

thheller17:02:40

cljs/user.cljs is loaded but applies to all builds and REPLs so I wouldn't use it

lilactown17:02:08

aha, thanks!

knubie17:02:47

Speaking of preloads, what’s the best way to set up spec instrumentation for a build? I tried calling instrument in a preloads namespace, but that didn’t work (I’m guessing because it gets called before the specs are defined?)

knubie17:02:05

☝️ specifically trying to set up instrumentation for my tests build

thheller18:02:27

in your preloads namespace you need to require all namespaces that you want to instrument

thheller18:02:42

that way it'll be loaded after those namespaces to ensure it can actually instrument them

knubie18:02:29

I see, thanks thheller

celwell21:02:56

Hi, I'm running a fresh lein new re-frame todo +10x +cider +test and at localhost:9630 the Builds tab and the Inspect tab work fine, but the REPL tab just says Loading... forever. Any ideas to try?

thheller21:02:41

use the cider REPL. the web thing is actually gone in the latest version. it'll return when I have more time to work on it

👍 4
cjsauer21:02:35

Does shadow cache dependencies in the usual .m2 directory? I’m playing with Netlify and I see that my builds always have to re-fetch all dependencies during the shadow-cljs - updating dependencies phase.

kaosko22:02:13

I'm using three.js as a node module and importing it to my cljs app works just fine thanks to shadow. three.js also comes with some examples. is it possible to easily import these underlying modules as well, similar to how you can just do import { Ocean } from './jsm/misc/Ocean.js'; in js?