shadow-cljs

Marten Sytema 2025-04-11T10:57:03.398919Z

Alrighty, everything is up and running, but one thing is still weird. I ’d love to use my CIDER setup, and it kinda works but something times out:

[nREPL] Starting server via /usr/local/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.3.1\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.52.1\"\}\ cider/piggieback\ \{\:mvn/version\ \"0.5.3\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[cider.nrepl/cider-middleware\,cider.piggieback/wrap-cljs-repl\]\"\]\}\}\} -M:dev:cider/nrepl
[nREPL] server started on 63319
[nREPL] Establishing direct connection to localhost:63319 ...
[nREPL] Direct connection to localhost:63319 established
[nREPL] Establishing direct connection to localhost:63319 ...
[nREPL] Direct connection to localhost:63319 established
Connected! Hack and be merry!
error in process filter: nrepl-send-sync-request: Sync nREPL request timed out (op eval code (require 'shadow.cljs.devtools.api)) after 10 secs
error in process filter: Sync nREPL request timed out (op eval code (require 'shadow.cljs.devtools.api)) after 10 secs

Marten Sytema 2025-04-11T10:57:32.611299Z

any pointers would be greatly appreciated 🙂

Marten Sytema 2025-04-11T11:06:37.492509Z

do i need cider.nrepl/cider-middleware if want to connect to the shadow-cljs repl, if i run npx shadow-cljs watch app in a separate terminal?

thheller 2025-04-12T09:20:46.465419Z

thats usually injected automatically when cider.nrepl is on the classpath

thheller 2025-04-12T09:21:06.069029Z

if you start the cider nrepl server then you need to add the shadow-cljs middleware instead

thheller 2025-04-12T09:22:09.629109Z

no clue if any of this is still accurate https://shadow-cljs.github.io/docs/UsersGuide.html#_using_deps_edn_with_custom_repl_intialization

Marten Sytema 2025-04-11T12:49:08.068059Z

got it working! For me it was not clear i should start a shadow-cljs repl (which auto matically also makes a clj repl) rather than a clojure-cli one with a sibling.

2025-04-11T12:05:48.847369Z

I see in the docs that "`:preloads` are only applied to development builds and will not be applied to release builds." What would be the best way to run a piece of code before everything else on a release build then? We're trying to call

uix.core/set-optimizations-enabled!
before any other CLJS gets run on our release build.

2025-04-11T12:40:58.896589Z

oh, I can just use :init-fn

thheller 2025-04-12T09:24:26.724849Z

that appears to be a macro, so setting it in :init-fn is likely "too late", since that is in a namespace that is compile last

thheller 2025-04-12T09:25:35.009539Z

you can use :entries [your.tweaks ] :init-fn in the build config. in the your.tweaks ns call the thing. if nothing else depends on that ns it should be "first", as in before any of your other application code

thheller 2025-04-12T09:26:14.366689Z

but looking at the code it appears to be enabled by default anyway?

2025-05-07T18:58:50.677159Z

Hey! sorry missed your response. The issue is that we need to set optimizations-enabled? to false instead of the default true