Fork me on GitHub

What is the recommended way to split code based on platform for a React Native application? I know there’s custom reader conditionals for .cljc files. Are there any ways to consider? Thanks


what does "split code based on platform" mean? if its just small snippets of code then reader conditionals make sense


it its actual full namespaces then it might be better to use separate entry namespaces


I don't use react-native so I don't know what people usually use


Is there a way to use shadow-cljs to output a cljs .jar? My colleagues and I were just discussing how to declare, for example, a minimum js dependency version in a cljs generated jar, and it seems like is how we’d plug into our existing build, but I note your comment on this ticket, and am not clear if there is an alternative method for declaring js deps in clojurescript output?


@mrkiouak shadow-cljs does not support creating/publishing .jar files. I use lein to do that. JS deps you declare via :npm-deps in deps.cljs, eg.


is that compatible with non cljsjs bundled npm libs now? My understanding was that used to require a cljsjs publish


ah… in testing it i see that it does work without a cljsjs published jar


I’m using the build report functionality and it’s super helpful. I’ve shuffled some modules around and I’m seeing a lot of stuff I did not expect into the “base” module. That is, stuff that are perhaps in a required namespace but not actually used in the entry file. Is there I way I can figure out why they are included and perhaps drop hints to shadow-cljs to move them to another module?


@orestis the logic is always to move dependencies as far "outside" as possible


if its moved up into base it is likely that you have 2 modules that are separate but depend on c


since it can't be in a AND b it is moved into the base


you requires are the only way to control where stuff goes


or if you absolutely want one namespace in a specific module you just declare it in the module :entries vector


then it will error out if it gets moved out and tell you why


Ah, so it’s namespace-level @thheller, right? Not function level like DCE? That makes sense. I will then probably need to split some large namespaces.


the config is namespace level


the final split is function level


in the report you'll often find a namespace split into multiple modules


but yeah smaller namespaces make for better splits


Hm, I expected namespaces into multiple modules but in my case it’s not happening effectively. I’ll dig around more to see what I can do to affect stuff.


JS dependencies might also affect this right? I guess they can’t be split as effectively.


yeah they'll stay in the module they are required in. never moved further.

Jag Gunawardana22:11:16

Has anyone had any luck using MathJax with shadow-cljs. I’ve done what I normally do (npm install mathjax; and then (:require [“mathjax” :as mj]) …. ) Just keep getting an empty {} when I look at what is in the namespace.