Open borkdude opened 2 years ago
That comment is all there is to read about it on this issue (which is about other, also interesting things). In fact you don't even need to read the full comment. Only this part, from Thomas Heller:
Never call this with shadow-cljs anywhere. It is never required in any setup and it will interfere with printing.
Sure, but why? I'd like to understand the details. Is there a way to have the same code behave well in both shadow and cljs.main?
I mainly wanted to hep you not have to read the whole issue. 😄 I don't know the details and haven't found any further info on this. Ping @thheller.
Fair enough :)
If you look at the implementation of enable-console-print!
you'll see that it unconditionally sets *print-fn*
and *print-err-fn*
. shadow-cljs
does set its own print-fn on load which will not only print to the console but also send all messages back to the shadow-cljs instances so it can send them futher along to the nrepl client or so.
As a safeguard I actually replace enable-console-print!
with a noop. I actually forgot that I did that but I did it because too many people called this and wondered why they were getting no more prints in the REPL. ;)
In essence you can call it but you shouldn't.
https://github.com/babashka/obb/blob/d8e5245dc3927527e89ce793f7fb2c57266e47f1/src/obb/impl/core.cljs#L62
See: https://github.com/BetterThanTomorrow/calva/issues/1468#issuecomment-1014781194
I still have to read the entire issue to find out why, when I have time.