Fork me on GitHub
#shadow-cljs
<
2023-01-08
>
Joshua Gelbard04:01:15

one character typo found, I think? looks like the vreset! in https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/cljs/devtools/server.clj#L567 is meant to be a reset!, since instance-ref is an atom.

Joshua Gelbard04:01:30

I could make a PR 😛 (seems like overkill)

Joshua Gelbard04:01:08

; eval (current-form): (reload!)
; (err) Execution error (ClassCastException) at shadow.cljs.devtools.server/reload! (repl_fast.clj:526).
; (err) class clojure.lang.Atom cannot be cast to class clojure.lang.Volatile (clojure.lang.Atom and clojure.lang.Volatile are in unnamed module of loader 'app')

thheller06:01:21

hmm right. it used to be a volatile but isn't used anywhere. so I guess nobody ever used it in 2 years or however long ago that change was

michihuber13:01:48

We want to call shadow.cljs.devtools.api/release to build our production asset, but we need to inject closure-defines into the config. is there are way to do this currently? are we holding it wrong/shouldn't have to do this? if not, would you accept a PR to either accept :closure-defines inside the opts or to accept the build-config instead of a build id as the first arg? (so then we can fetch the config via s.c.d.config/get-build , override the closure-defines and pass it to release). could also go via release*, but then you have to set up the env etc. and from my current POV this could be a useful feature. (this is not about injecting a define that differs between envs – think e.g. hosted client vs on-prem client, where we need to configure different backends)

thheller15:01:43

its fine to call the release* function directly. just need to setup the runtime once. which is just (api/with-runtime ...) just like here https://github.com/thheller/shadow-cljs/blob/653dfa0cea96c496acc9a204ce644de284d69c50/src/main/shadow/cljs/devtools/api.clj#L343-L349

thheller15:01:41

as Martin suggested config-merge is also an option. it can be passed in opts via {:config-merge [{:clojure-defines {'foo.bar 1}}]}. note the extra vector though.

🙌 2
thheller15:01:05

usually easier to just get the build config directly and modify it however you want

thheller15:01:36

if you run via https://shadow-cljs.github.io/docs/UsersGuide.html#clj-run the runtime is already created, so you could skip the with-runtime