After quickly trying this out it seems impossible to have a "dangling" 
require after ns form, probably because (quoting the article I linked to in 
previous comment):

A file can have one of: 
>    
>    - a namespace declaration, *or*
>    - (possibly several) require forms, 
> *or *
>
> So it looks like indeed there's no way to do a conditional require and 
library A should provide some other way to allow user decide whether 
printing should be affected. Some solutions off the top of my head:

1) For "property-based" configuration you could try using :closure-defines 
compiler feature.
2) There's also an :external-config pattern which I find easier to work 
with (example: 
https://gist.github.com/metametadata/bb00917e09463f6ce04f0e50ccc0740a). But 
it seems to not be recommended anymore after shared AOT cache was 
introduced (see https://clojurescript.org/news/2018-03-28-shared-aot-cache).
3) https://github.com/binaryage/env-config (which I haven't tried).
4) Printer could be modified only on demand instead of doing a global side 
effect on requiring libA ns. E.g. add an explicit 
`libA.core/enhance-printer!` function. This is the approach I saw in libs 
which affect Clojure test reporting (ultra and humane-test-output) where 
they expose `activate!` function.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to