shadow-cljs 2025-02-10

It looks like this (powershell) doesn't work (the host is not respected):

yarn shadow-cljs --config-merge "{:http {:host `"foo`"}}" run dev/setup
Where dev.clj is a file with a setup function that has {:shadow/requires-server true}. Should it?

> Looks like I should turn off requires-server, then start it manually with a patched config? I tried that, but now I get this error:

NullPointerException: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null
        clojure.core/deref-future (core.clj:2317)
        clojure.core/deref (core.clj:2337)
        clojure.core/deref (core.clj:2323)
        shadow.cljs.devtools.server.supervisor/active-builds (supervisor.clj:14)
        shadow.cljs.devtools.server.supervisor/active-builds (supervisor.clj:12)
        shadow.cljs.devtools.api/worker-running? (api.clj:124)
        shadow.cljs.devtools.api/worker-running? (api.clj:120)
        shadow.cljs.devtools.api/watch (api.clj:206)
        shadow.cljs.devtools.api/watch (api.clj:200)
        shadow.cljs.devtools.api/watch (api.clj:204)
        shadow.cljs.devtools.api/watch (api.clj:200)
        dev/setup/body-fn--16595--auto----7247 (dev.clj:71)
        dev/setup (dev.clj:68)
        dev/setup (dev.clj:52)
        clojure.lang.Var.applyTo (Var.java:705)
        clojure.core/apply (core.clj:667)
        clojure.core/apply (core.clj:662)

Never mind, worked around it

you should maybe consider using clj -X dev/setup or whichever flag that was

and in setup call (server/start!) with server being shadow.cljs.devtools.server

Ah using clj is better? I guess I would need to switch this project to deps (I just have the shadow-cljs.edn currently). shadow.cljs.devtools.server/start! - that is the one I was trying, but then it said :already-running or something, and the call to watch broke. Also tried it with and without the with-runtime wrapper.

well watch requires a running server, {:shadow/requires-server true} starts that. if you otherwise use run the expectation is that you didn't need a server and just wanted a release build or so. so only a partial runtime is started. kinda not intended to call start with run

Ah, I see. Well I ended up with just using #shadow/env to specify the host, that seems to work well.

--config-merge ONLY merges stuff into the build config. it cannot take config that is not build specific. so here it isn't even applied anywhere

Looks like I should turn off requires-server, then start it manually with a patched config?

dunno what you are trying to achieve here?

why set the host in the first place?

I'm testing a new thing where it needs to be dynamic for each developer

I'm also fairly certain that powershell quoting looks much different from what you have? it sort of gets crazy with EDN

It looked right via echo, but I didn't get far enough to confirm, and I guess it doesn't matter if that setting can't be set via config-merge