Fork me on GitHub

can a shadow-cljs project produce a jar file without js dependencies? What I want to do is from one project, I want to produce a NPM package for js projects and cljs jar package for cljs projects.


For cljs projects to fill out the js dependencies, I was thinking I could use the webpack method that described here


shadow-cljs doesn’t currently have a way of creating a jar AFAIK. I usually use a very minimal project.clj and use leiningen to create a jar + publish it

👍 4

@ghiden CLJS packages are just uncompiled .clj(s|c) files. you never ship compiled CLJS code to other CLJS users. so any method of producing/publishing a jar file it valid you do not need shadow-cljs for that, although it will likely get support for it at some point.


i guess the last piece that i need to figure out is whether cljs projects can use webpack to load the npm dependencies required by the published package


for now my recommended path is to use the cljsjs compatibility layer instead


since the webpack part requires additional work on the lib consumer side


its not an ideal solution either though


I have a node module that I’ve installed into an existing clj/cljs project that uses lein. I’m having some issues getting things to compile, would shadow-cljs be helpful for my scenario? I already have an existing build system, so I don’t want to replace that but if they could live in harmony together that would be ideal 🙂


not sure I understand the question. shadow-cljs is a build tool so you are going to replace your existing build system if you use it. it is however fine to use it from lein.


right now Im trying to follow the guide, and things aren’t working out for me


my node module is a React component that I’ve built and put on NPM


so when I try to fire everything up I get some issues around React not being available


Uncaught ReferenceError: module$react is not defined


so I was wondering if some how including shadow-cljs can help me with these issues


sorry can't help you troubleshoot the webpack setup. don't know anything about it.


but with shadow-cljs you just npm install the-thing and (:require ["the-thing" :as x])


the only reason I think I was pointed to the webpack guide is because I’m using webpack to build my React component, but I don’t think those things should be related


do you have documentation on how I should integrate this with lein?


I recommend first starting without lein


figure out how things work. then integrate it into lein


ie. npx create-cljs-project test-project cd test-project npm install your-thing


got it, so understand how things work in isolation before trying to integrate it into my existing stuff


well you can use your actual code if you want to. that is not a problem


just don't do it via lein


FWIW you might be able to skip the publish to npm part completely and just consume the code directly via


@thheller Late congrats on the clojurists together funding (I'm back from a break)


much better perf out-of-the-box and supports optional byte[] responses, than enable NIO in some servers


I started shadow-cljs fresh this morning and was receiving this message:

------ ERROR -------------------------------------------------------------------
09:29:53 cljs |  File: /home/kenny/compute_software/ui-frontend/src/compute/ui_frontend/components/constructors.cljs
09:29:53 cljs | Exception: No namespace: compute.ui-frontend.components.constructors found
The constructors ns follows the two ns pattern for exposing macros - there's a constructors.clj and a constructors.cljs. I had forgotten to remove a reader conditional from my constructors.clj file which caused that error. Once I fixed it the error went away. If I add the misplaced reader conditional back in after the initial compile, I get a much better error:
09:30:43 cljs | [2018-09-04 09:30:43.832 - WARNING] :shadow.cljs.devtools.server.reload-macros/macro-reload-ex - {:ns-sym compute.ui-frontend.components.constructors}
09:30:43 cljs | CompilerException java.lang.RuntimeException: Conditional read not allowed, compiling:(compute/ui_frontend/components/constructors.clj:9:3)


It'd be nice if the latter error was printed instead of the obtuse first one.

Josh Horwitz20:09:57

I’m looking to use an Ant design library with my shadow app, would it be best to use the antd react package from NPM or which is a clojurescript lib


antizer looks nice. the only thing to note is that you might have some additional steps since it uses cljsjs

Josh Horwitz20:09:40

Thanks! I’ll try and go the antizer route since I know it already


I really don't recommend using wrappers like antizer. it'll pull in every single thing in antd. meaning your final JS grows by at least 1mb


probably way more


if that is not important to you than its totally fine to use of course

Josh Horwitz21:09:15

Here’s a quick starter I put together using the wrapper, I will work on using it without next. Thanks!


hey everyone, curious if anyone else has run into issues using test.check/defspec with the default :runner-ns shadow.test.browser. the workaround is easy, i just wrote a custom runner that calls clojure.test/run-tests in start, but curious if im missing something or what other solutions may be out there