Fork me on GitHub
#shadow-cljs
<
2019-03-04
>
heyarne10:03:29

Hm... when starting the shadow-cljs server it tells me the nrepl-middlware can't be found on the classpath. How would I debug this? The dependency is added to the [shadow-cljs.edn](https://github.com/heyarne/airsonic-ui/blob/53748941c0d1b5439ff5774fe9e872c5ded06d3d/shadow-cljs.edn#L18).

heyarne10:03:30

Also CIDER seems to pass the dependency explitly as well: [nREPL] Starting server via /usr/bin/npx shadow-cljs -d nrepl:0.5.3 -d cider/piggieback:0.3.10 -d refactor-nrepl:2.4.0 -d cider/cider-nrepl:0.20.0 server...

thheller10:03:46

what does it say on startup?

thheller10:03:24

hmm you probably need to update shadow-cljs. there were a bunch of changes in nrepl and cider-nrepl not too long ago and I believe nrepl 0.6.0 is required now

thheller10:03:37

newer shadow-cljs versions provide the nrepl 0.6 version

thheller10:03:56

probably also need to bump cider-nrepl to 0.20.0 since the CLI inject adds that version

thheller10:03:41

the nrepl.middleware.caught ns is part of nrepl now and wasn't previously

thheller10:03:59

so either bump shadow-cljs or include [nrepl "0.6.0"] in your deps as well

heyarne10:03:32

seems to work fine with 2.8.14, thanks!

deplect10:03:28

Goodday everyone, was wondering if there is an idiomatic way of recognising I am either in a development build or I am performing a release build in shadow-cljs. Mainly to configure timbre and to disable some functionality I want in the dev builds vs production builds

thheller10:03:53

you can also use goog.DEBUG which is a built-in closure-define which will be false in release builds

deplect10:03:23

@thheller thank you again Thomas

thheller10:03:03

you can also use :preloads if you want to add namespace you'd rather not use in a release build. https://shadow-cljs.github.io/docs/UsersGuide.html#_preloads

thheller10:03:58

eg. create a your.app.logging-dev namespace and include it via :preloads

lkonstantinov12:03:20

hey - i am having some problem with shadow and httpurr (or probably promesa) when using advanced compilation

lkonstantinov12:03:51

I guess some sort of extern failure

thheller12:03:51

you can also use shadow-cljs release your-app --pseudo-names

thheller12:03:06

will make it easier to figure out that is getting renamed there

lkonstantinov12:03:53

seems to be the same with :infer-externs :auto

thheller12:03:54

infer-externs will only warn you about stuff

thheller12:03:13

you need to add the ^js hints whenever it warns about something

thheller12:03:40

but yeah that tells you that .caught is getting renamed when it shouldn't but it seems to be something in promesa

thheller12:03:51

so you won't get a warning about that since its not in your code

lkonstantinov12:03:14

yeah, i was hoping it was some sort of known problem with promesa 🙂

thheller12:03:34

you can also probably just use :simple optimizations for node

thheller12:03:47

:compiler-options {:optimizations :simple}

thheller12:03:54

that will avoid dealing with externs

lkonstantinov12:03:21

let me see if i can get it working with the custom externs first, but yes - :advanced is not really needed for node, so if push comes to shove...

lkonstantinov12:03:57

perfect, worked with adding two externs - caught and on 🙂 --pseudo-names was excellent

pvillegas1217:03:04

After adding a lib in the package.json, how do I require it in my cljs file?

thheller20:03:30

typically just (:require ["that-package" :as x]) in your ns

pvillegas1220:03:11

👍 @thheller I would that example more prominently 😄

hlolli23:03:25

any cider users encountered this with cider-nrepl 0.21.0 or later?

[2019-03-05 00:14:50.420 - WARNING] :shadow.cljs.devtools.server/nrepl-ex
CompilerException java.io.FileNotFoundException: Could not locate nrepl/middleware/caught__init.class or nrepl/middleware/caught.clj on classpath., compiling:(cider/nrepl.clj:1:1)

hlolli23:03:17

ah I only had to scroll bit up to see this mentioned 😛

hlolli23:03:19

not an error in shadow-cljs 2.8.14

dpsutton23:03:28

i think you need -d nrepl:0.6.0

hlolli23:03:49

I think it must be included with the newest shadow-cljs, since it works just by bumping shadow.

hlolli23:03:18

I somehow thought shadow-cljs updated it self automatically, is that featured turned off now?

lilactown23:03:56

no, shadow-cljs will correspond with whatever is installed in your local project

lilactown23:03:27

either via npm or whatever classpath solution you use (deps.edn/leiningen/boot) if you use their integration

hlolli23:03:35

ah I see, I'm on npm. Ok, makes more sense in terms of reproduceable builds, to have this declerative. But cosy for development. I use ncu -a which bumps all my npm deps, including shadow, so not a problem for me.