Fork me on GitHub

At my day job we have mostly ClojureScript projects, but one project is being ported to NextJS. This is a browser project. We have some libraries written in ClojureScript that we want to consume from the NextJS project. What are our options if we do not want to load several instances of the ClojureScript runtime? Since it is only one JS project maybe it would work to build one browser module with one endpoint per CLJS library? Any new JS projects would do something similar.


hi @thheller. since the last cljs release, data_readers.cljc containing reader conditionals works. for example:

#?(:clj {}
   :cljs {foo/bar})
but this does not work in shadow. It looks like `
is not getting called as it does when invoking


they are opt-in in shadow-cljs. you need to set :compiler-options {:data-readers true} in the build config


no clue if it works then though. I don't think data readers should ever be used for anything directly in source code


also, tags from data_readers.cljc files are used when reading data with cljs.reader fns


yeah, and I don't ever want those to leak into my build just because they are on the classpath


it also creates certain "undefined load order" issues since things break if you don't actually ever require the namespaces uses in those directly


if you do all bets are off regarding caching and build reliability. so use with care.


thanks I'll try that. I use them at the repl


it's not working. in shadow I see

;; taken from cljs.closure since its private there ...
(defn load-data-reader-file [mappings ^ url]
in . the load-.. fn has moved to cljs.analyzer and is still private. although e.g.
is public, with memoized and unmemoized versions


please create an issue for this. can't get to it right now

πŸ‘ 1

Hi, I am getting

Execution error (AWTError) at sun.awt.X11GraphicsEnvironment/initDisplay (
Can't connect to X11 window server using '
when running npx shadow-cljs browser-repl . I am inside a VM without X-server. Anyone has an idea?


ok got it, sorry

Samuel McHugh15:05:28


Execution error (ClassNotFoundException) at (
Unfortunately haven't been able to reproduce this issue in a simple project. Using
org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/clojurescript {:mvn/version "1.11.51"}
thheller/shadow-cljs {:mvn/version "2.19.0"}
I'll include the full stacktrace in this thread.

βœ… 1

very likely to be a dependency conflict. make sure you have the appropriate closure-compiler and cljs versions (guessing you are using project.clj or deps.edn to manage dependencies)


check which closure-compiler version oyu are getting via clj -A:your-aliases -Stree or so

βœ… 1
Samuel McHugh15:05:49

org.clojure/clojurescript 1.11.51
  . v20220502 :newer-version


seems correct


run clj -A:your-aliases and then (require ')


( "com/google/javascript/jscomp/JSModule.class")


seems like your dependencies got messed up somehow


this file isn't supposed to exist


you do actually use deps.edn to manage dependencies correct? there is a :deps true or :deps {:aliases ...} in your shadow-cljs.edn?


you seem to have a old shadow-cljs version? JSModule has been gone for a while now


check ( "shadow/build/closure.clj")

Samuel McHugh15:05:45

#object[ 0x7af707e0 "jar:file:/home/foobar/.m2/repository/thheller/shadow-cljs/2.19.0/shadow-cljs-2.19.0.jar!/shadow/build/closure.clj"

Samuel McHugh15:05:05

But fair enough. I'm working in a mono repo with lots of projects, most of which are on old versions of shadow. I'd expect -Stree to have revealed that the old shadow is being used but maybe there is something else funky going on.


hmm yeah dunno. that file is definitely not trying to load JSModule anywhere


(it was renamed to JSChunk a while ago in the closure-compiler)


my guess is an incompatible mix of shadow-cljs, cljs and closure-compiler somewhere


closure compiler version you can check via ( "com/google/javascript/jscomp/JSChunk.class")


I'd assume that exists


maybe some bad leftover AOT code? so try ( "shadow/build/closure__init.class")

Samuel McHugh15:05:40

#object[ 0x7da10b5b "jar:file:/home/foobar/.m2/repository/com/google/javascript/closure-compiler-unshaded/v20220502/closure-compiler-unshaded-v20220502.jar!/com/google/javascript/jscomp/JSChunk.class"]


that all looks fine. assuming that is what the classpath actually is when shadow-cljs runs


I mean you can just (require ' in the REPL


that should be fine then

Samuel McHugh15:05:37

Found the issue... 🀯 There are actually 2 shadow builds that run in parallel when I call a script and so the error messaging was coming from that second build which I never pay attention to. Oops. And ofcourse it has its own deps.edn and so I was checking in the repl sourcing the wrong deps.edn. TLDR: running stuff in parallel makes logs confusing πŸ™‚

Samuel McHugh16:05:59

Thanks for your help. Much appreciated

yura parenyuk20:05:12

Hello everyone! I am in need of help with installation of shadow-cljs. I'm trying to add syncfusion dependency, but it's giving error: The required JS dependency "@syncfusion/ej2-react-layout" is not available, it was required by "poc/core.cljs".


did you install it via npm install @syncfusion/ej2-react-layout in the project dir?

yura parenyuk20:05:40

It's in package.json, and I have it installed too.


quick google suggest the package name is actually @syncfusion/ej2-react-layouts. so you are missing an s?

πŸ‘€ 1
πŸ‘ 1
yura parenyuk20:05:36

Oh... my ... :man-facepalming:

yura parenyuk22:05:37

Hi @thheller, I have coded the the components, it's compiling successfully, but output is not showing.

yura parenyuk22:05:50

It means I've coded the components, but there's something wrong with Interop. Right?


don't have a clue. I know neither the library you are using nor the interop lib. I also haven't used react in many years. ask in the appropriate channel.