Is it possible to have different :init-fn's for a build when running in debug (watch) vs release mode?
dunno why you would but sure, see https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration
basically :modules {:foo {:init-fn foo/init}} :dev {:modules {:foo {:init-fn bar/init}}}}
everything from :dev or :release is just merged and can replace values
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.
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.
the above functionality solves my problem exactly as I wanted
damn is there something you haven't thought of?
I have never thought about doing this particular thing before 😛
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?
this function is called once on startup. https://github.com/thheller/shadow-cljs/blob/5206a38935005a2d398847193ed1d03499945d29/src/main/shadow/cljs/devtools/server/npm_deps.clj#L177
you can just call it yourself if needed.