shadow-cljs

agorgl 2026-01-12T18:34:22.141619Z

Is it possible to have different :init-fn's for a build when running in debug (watch) vs release mode?

thheller 2026-01-12T18:56:47.536959Z

dunno why you would but sure, see https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration

thheller 2026-01-12T18:57:20.248609Z

basically :modules {:foo {:init-fn foo/init}} :dev {:modules {:foo {:init-fn bar/init}}}}

thheller 2026-01-12T18:58:03.470669Z

everything from :dev or :release is just merged and can replace values

agorgl 2026-01-12T18:59:54.570719Z

Reasoning: I want to have different entrypoint setup for development and release builds. In the development builds I will wire up some development tools that only exist on the classpath when :dev alias is used, so I would ideally like to have different init namespaces for dev and release builds.

thheller 2026-01-12T19:01:04.287579Z

usually that is done via :preloads, but a separate ns/:init-fn is fine too I guess. nothing really wrong with doing it that way.

agorgl 2026-01-12T19:02:10.130839Z

the above functionality solves my problem exactly as I wanted

agorgl 2026-01-12T19:02:22.529179Z

damn is there something you haven't thought of?

thheller 2026-01-12T19:03:14.687799Z

I have never thought about doing this particular thing before 😛

😀 1
agorgl 2026-01-12T21:55:07.021539Z

Is the npm interface of shadow-cljs doing some kind of magic behind the scenes in addition to the shadow.cljs.devtools.api that installs extra npm dependencies from cljs dependencies like this: https://github.com/cjohansen/dumdom/blob/master/src/deps.cljs#L6 ? How can I replicate this functionality using the api?

thheller 2026-01-13T06:21:55.963199Z

you can just call it yourself if needed.

👍 1