Fork me on GitHub
#shadow-cljs
<
2019-10-13
>
Crispin07:10:18

Just a quick question about shadow-cljs. Does shadow-cljs support JVM servers? I have cljc codebase, with clj server code and cljs client code. Can I build my cljs artifacts with shadow-cljs with a JVM based server uberjar containing that artifact?

Stefan08:10:42

Hi @thheller, I’d like to bounce an idea off you if you don’t mind. I am designing a novel way to build cross-platform mobile apps, without React Native. It uses JavaScript as the main language for programming application logic. Hence I need a bundler. I was wondering if it would be a good idea to use shadow-cljs for that. I target my solution at JavaScript devs, so you could write apps using only JavaScript. I could of course use webpack or something like that, but using shadow-cljs has the added benefit that people could also use ClojureScript if they want, without any additional configuration. Would you say this use of shadow-cljs aligns sufficiently with what you intend it to be? This is of course important to make my solution “future proof”. Also, one issue I see (which I’m not sure if I can solve by configuring shadow-cljs) is that the user’s code as compiled by shadow-cljs gets “scoped” (e.g. module$demo$foo) so it’s “clumsy” when you need to call this from a native web view in iOS/Android. Thanks for sharing your thoughts!

thheller08:10:25

@stefan.van.den.oord it could technically work yes but the focus is purely on CLJS. so while the occasional JS include works fine building actual full JS projects has more than a few rough edges. (eg. no externs inference for JS)

Stefan08:10:46

Yeah I guess that’s what I felt as well. Back to the hammock 😉 Thanks!

thheller08:10:49

if you only allow pure strict ES8 code or so then everything would be fine

thheller08:10:02

but I'm assuming you want access to npm and commonjs

Stefan08:10:41

Yeah indeed, it should be as open as possible to other dependencies. And clojurescript preferably 🙂

thheller08:10:32

yeah, then things get a lot more complicated

thheller08:10:55

@retrogradeorbit I'm not quite sure what you are asking. shadow-cljs produces .js files. those files you can include uberjars like normal. you can run that as part of lein uberjar yes, although I typically recommend doing something like shadow-cljs release app && lein uberjar instead

Crispin09:10:51

ok cool. so I could still generate my existing jar with leiningen, and use shadow-cljs to build the js artifacts. Thanks!