Fork me on GitHub
#shadow-cljs
<
2018-11-12
>
mhuebert17:11:09

is there any blessed way to figure out the current target at macro-expansion time? eg. to switch based on “nodejs” or “browser”

mhuebert17:11:01

eg

(= "nodejs"
     (-> @cljs.env/*compiler*
         :options
         :closure-defines
         (get 'cljs.core/*target*)))

lilactown17:11:45

:thinking_face:

lilactown17:11:00

I have used reader conditionals in a .cljc file to do this

4
lilactown17:11:30

not sure how to do that in e.g. a macro tho

lilactown17:11:48

or how it relates to macroexpansion

thheller18:11:44

@mhuebert anything in :compiler-options ends up in (:options @cljs.env/*compiler*) so you could add your own option

thheller18:11:51

but no there is no officially sanctioned way

thheller18:11:55

:compiler-options {:external-config {...}} has some extra treatment to invalidate all cache when anything in there changes

thheller18:11:59

so might want to put it in there

thheller18:11:37

conditional reading might work if you can just include a different namespace and just have 2 different implementations

thheller18:11:08

(:require [#?(:node some.thing :cljs some.other-thing) :as foo])

heyarne19:11:44

how can i restrict the memory allocated to shadow-cljs?

mhuebert19:11:19

The conditional reads might be exactly what I want

mhuebert19:11:36

I didn't notice the shadow support for that

thheller19:11:58

@arne-clojurians :jvm-opts ["-Xmx1G"] in the shadow-cljs.edn top level

thheller20:11:18

might be able to run with -Xmx256M but probably not much lower than that

🙏 4
haywood20:11:57

anyone ever seen this? it's gotta be something simple, I'm working from a project I have locally as a template, and it works over there, I'm only removing aliases I no longer need... Caused by: java.lang.RuntimeException: Unable to resolve var: comp/*source-map-data-gen-col* in this context

mhuebert20:11:10

@haywood that looks like what I got when I ran the latest version of shadow with an older version of ClojureScript pinned in my Deps somewhere

haywood20:11:01

makes sense, let me track that down

thheller21:11:57

@haywood yes 2.7.X requires CLJS 1.10.439. this is enforced when using shadow-cljs.edn but lein or so may need manual tweaking

thheller21:11:40

unfortunately they added a new requiring binding which means older versions aren't compatible anymore

haywood21:11:21

interesting ok. I'm using 2.4.24 and 1.10.339.

thheller21:11:16

that can't be. 2.4.24 did not use that binding

thheller21:11:37

neither did 1.10.339 so at least one version differs

haywood21:11:08

dang, great memory, ok I'll dig into what's installed locally to see what's up

haywood21:11:36

oof, I think the problem was re-installing deps without deleting my .cpcache directory 😞 😞 😞

haywood21:11:44

that was copied over