shadow-cljs

henrik 2025-05-16T08:27:05.705949Z

Getting this with ClojureScript 1.12.42. Works fine with 1.12.38

jrychter 2025-05-20T04:48:28.805199Z

I just tried upgrading and I get the same message with 3.1.1 and ClojureScript 1.12.38. I can't upgrade ClojureScript for now, it brings in a protocol buffers dependency which breaks one of the older libraries I use. Am I stuck on 3.0.5, then?

[2025-05-20 13:45:20.426 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:type :start-autobuild}}
NoSuchMethodError 'com.google.javascript.jscomp.jarjar.com.google.common.collect.ImmutableSet com.google.javascript.jscomp.AbstractCompiler.getExternProperties()'
        com.google.javascript.jscomp.ShadowAccess.getExternProperties (ShadowAccess.java:32)
        shadow.build.closure/load-extern-properties (closure.clj:1060)
        shadow.build.closure/load-extern-properties (closure.clj:1040)
        shadow.build.compiler/compile-cljs-sources (compiler.clj:1372)
        shadow.build.compiler/compile-cljs-sources (compiler.clj:1366)
        shadow.build.compiler/compile-all (compiler.clj:1653)
        shadow.build.compiler/compile-all (compiler.clj:1511)
        shadow.build.api/compile-sources (api.clj:261)
        shadow.build.api/compile-sources (api.clj:253)
        shadow.build/compile (build.clj:522)
        shadow.build/compile (build.clj:503)
        shadow.cljs.devtools.server.worker.impl/build-compile (impl.clj:368)

thheller 2025-05-20T05:37:25.803809Z

@jrychter it is important that the expected versions match exactly. you with 3.1.1 you need to be on clojurescript 1.12.42. otherwise this exact problems happens, due to there being a closure-compiler and closure-compiler-unshaded on the classpath

thheller 2025-05-20T05:38:13.235729Z

and the newer clojurescript uses a shaded closure-compiler version of the protocol buffers which shouldn't conflict with anything?

thheller 2025-05-20T05:38:55.851469Z

or does it conflict with something else shaded? i.e. something with jarjar in the classname? shouldn't really happen but who knows. if you look at the dependency graph there should only be a closure-compiler with no extra dependencies. no closure-compiler-unshaded. so technically there should be no protobufs dependency at all coming from cljs/closure

jrychter 2025-05-20T06:10:09.207469Z

I can't be on clojurescript 1.12.42, at least until I dive in and understand the protobuf problem exactly. It's likely the old library will need to be fixed/updated, which will not happen unless I do it myself. So, assuming I have to stay on ClojureScript 1.12.38, which shadow-cljs version should I stay with?

thheller 2025-05-20T06:11:14.503059Z

what is the problem? maybe I can help. 3.0.5 is the version

jrychter 2025-05-20T06:12:04.544629Z

I will dive in, but I can't do it right now — for now, I'm staying on 3.0.5 in that case.

thheller 2025-05-20T06:12:33.906279Z

nothing much changed other than the closure/cljs bump, so you are not missing much yet

thheller 2025-05-20T06:13:43.881529Z

I'm still curious to hear about the problem you have. I'm still a bit skeptical about the move to the shaded closure-compiler jar, so would be good to get some data on where it is actually causing issues (if thats the cause)

thheller 2025-05-16T08:31:49.102239Z

works fine for me. are you sure you didnt' also change some other dependencies? like guava/datomic/closure-compiler?

henrik 2025-05-16T08:36:08.689909Z

I did change some other deps, but none of those. I got the error, flipped back to 38. Perhaps it was a one-off, I’ll flip over to 42 to see if I can reproduce it.

thheller 2025-05-16T08:36:19.772929Z

as a general rule I do not recommend upgrading cljs separately, I only test released with the declared cljs release at that time. so no guarantee that any random version switches will work.

thheller 2025-05-16T08:36:40.893949Z

just released shadow-cljs 3.0.6 which includes the cljs bump

henrik 2025-05-16T08:37:11.369899Z

Ah, OK! That’s good to know, I’ll just remove cljs as a dep then. Thanks!

thheller 2025-05-16T08:37:20.452169Z

not that there is anything useful in CLJS itself. the upgraded closure library is nice though, reverts some unnecessary breakage

henrik 2025-05-16T08:38:35.221239Z

Depends on which previous version you were on. Mine was 11.something

henrik 2025-05-16T08:38:55.233059Z

Although I haven’t checked what’s new in 12

Derek 2025-05-16T16:09:51.694339Z

Seeing something similar (I think):

[2025-05-16 11:09:27.664 - WARNING] provide conflict for #{goog.reflect} provided by goog/reflect/reflect.js and {"/lib/reflect.js" #{goog.reflect}}
[:homepage] Compiling ...
Execution error (NoSuchMethodError) at com.google.javascript.jscomp.ShadowAccess/getExternProperties (ShadowAccess.java:32).
'com.google.common.collect.ImmutableSet com.google.javascript.jscomp.AbstractCompiler.getExternProperties()'

Full report at:
/var/folders/l2/4c_1v4jj7kj9sfhwjmplz2s80000gn/T/clojure-9357320417196391944.edn

thheller 2025-05-17T05:34:01.828129Z

do you use deps.edn/project.clj? if so check your dependency tree if there are any conflicts. also verify you are getting the correct closure compiler and cljs versions

jrychter 2025-05-20T08:20:33.937659Z

Of course. I will get back to you once I find a moment to dig into this.

Shantanu Kumar 2025-05-17T07:46:56.923719Z

I get a similar ^ error when I explicitly put CLJS 1.12.42 in my deps.edn dependencies - the error goes away when I omit the CLJS dependency entry to let shadow-cljs (3.0.6) fetch it transitively.

thheller 2025-05-17T07:47:54.271789Z

someone setup a repro. I kinda can't believe that this is the only thing going on 😛

Shantanu Kumar 2025-05-17T08:03:25.426369Z

@thheller I am able to reproduce the issue with these steps: 1. Run npx create-uix-app@latest my-app 2. Run cd my-app; npm i; npm run dev to see that the app works 3. Edit deps.edn and package.json to update CLJS (1.12.42) and Shadow-CLJS (3.0.6) versions 4. Run step 2 again to repro

thheller 2025-05-17T08:08:40.411619Z

that is rather weird

thheller 2025-05-17T08:29:35.746329Z

I don't get it. the only thing different is the classpath order, but I can't figure out why thats a problem. AFAICT there are not conflicting files in those jars

thheller 2025-05-17T08:46:47.604059Z

ah found it

2025-05-17T13:27:36.464569Z

I'm hitting this also with something like :

{:deps {thheller/shadow-cljs {:mvn/version "3.0.6"}
        org.clojure/clojurescript {:mvn/version "1.12.42"}}}
Even when adding the same clojurescript version shadow depends on. The difference I'm seeing in both classpaths are the order of these :
$ diff work doesnt.work 

3a4
> /home/jmonetta/.m2/repository/org/clojure/clojurescript/1.12.42/clojurescript-1.12.42.jar
13a15,16
> /home/jmonetta/.m2/repository/com/google/javascript/closure-compiler/v20250402/closure-compiler-v20250402.jar
> /home/jmonetta/.m2/repository/org/clojure/google-closure-library/0.0-20250515-f04e4c0e/google-closure-library-0.0-20250515-f04e4c0e.jar

22d24
< /home/jmonetta/.m2/repository/org/clojure/clojurescript/1.12.42/clojurescript-1.12.42.jar
25d26
< /home/jmonetta/.m2/repository/org/clojure/google-closure-library/0.0-20250515-f04e4c0e/google-closure-library-0.0-20250515-f04e4c0e.jar
49d49
< /home/jmonetta/.m2/repository/com/google/javascript/closure-compiler/v20250402/closure-compiler-v20250402.jar

thheller 2025-05-17T14:19:04.310299Z

yeah I found the problem. see #cljs-dev will fix later

🙌 1
thheller 2025-05-17T14:19:36.717419Z

basically both the closure-compiler and closure-compiler-unshaded jars are on the classpath. if the unshaded comes first it works, the shaded first breaks due to using other renamed/shaded classes

❤️ 1
thheller 2025-05-17T16:44:55.670739Z

should be fine in 3.1.1

🚀 1
2025-05-17T16:49:06.403689Z

works for me now! thanks @thheller!

jrychter 2025-05-27T02:19:48.570909Z

I found a moment to dig into this. After upgrading thheller/shadow-cljs '3.0.5' to '3.1.4' and org.clojure/clojurescript '1.12.38' to '1.12.42', the error above wasn't there. Instead, I was getting an error about missing classes from the protobuf library. This made sense because the new ClojureScript does not include protobuf as a dependency. I use some other old libraries which do, but I had excluded protobuf from their dependencies because they were pulling in old versions that conflicted with ClojureScript. After adding com.google.protobuf/protobuf-java "4.31.0" as an explicit dependency, everything now compiles without any errors.

👍 1
grav 2025-05-16T11:11:28.230289Z

I'm using

{:builds 
  {:app {:dev {:compiler-options
                {:reader-features #{:dev-config}}} ...
to include some additonal hiccup in a react component like this:
[:div
 #?(:dev-config
   [:div
    [:pre (util/spprint @!state)]])
 [:div ...

grav 2025-05-16T11:13:38.821789Z

Works well! However I needed to make my .cljs file into a .cljc to avoid "Conditional read not allowed". I'm probably mis-using the feature then? What's another way to achieve what I want; to compile some additional stuff on dev-time?

thheller 2025-05-16T11:31:38.423299Z

reader conditionals only work in .cljc files, I don't know why but cljs handles it like that and I'm sticking to it. technically custom reader features aren't even allowed and were rejected by core

thheller 2025-05-16T11:31:58.773099Z

the good old (when DEBUG ...) pattern works best I guess?

thheller 2025-05-16T11:32:27.041499Z

where (goog-define DEBUG false) is used somewhere and can be enabled via :dev {:closure-defines {that.ns/DEBUG true}}

💡 1
thheller 2025-05-16T11:32:39.539269Z

or enabled by default and disabled in :release. your choice

thheller 2025-05-16T11:33:08.315839Z

closure :advanced will usually be able to remove such branches entirely

grav 2025-05-16T11:35:04.681639Z

Great, makes sense 👍 I thought it was a Shadow-cljs feature, but now I also get why it's so deeply burried in :compiler-options 😅

thheller 2025-05-16T11:35:49.298169Z

it is a shadow-cljs only feature

grav 2025-05-16T11:36:09.535339Z

The :reader-features?

thheller 2025-05-16T11:36:14.920859Z

yes

grav 2025-05-16T11:36:29.992249Z

Oh, okay. So then I'm not following > cljs handles it like that and I'm sticking to it

thheller 2025-05-16T11:37:03.860069Z

cljs doesn't allow using reader conditionals in .cljs files, I'm following that rule.

thheller 2025-05-16T11:38:11.437889Z

adding custom reader-features is not supported at all in regular cljs, even in .cljc files

grav 2025-05-16T11:38:13.547639Z

Ah, okay. Why is it a compiler option then? Isn't that referring to the cljs-compiler, and not shadow-cljs?

thheller 2025-05-16T11:39:14.877259Z

well it is still affecting the compiler, so make sense there? technically its just the reader, but oh well its gotta go somewhere

thheller 2025-05-16T11:39:44.488889Z

top level in the build config is usually affecting the build as a whole, not just the CLJS->JS compilation

grav 2025-05-16T11:41:35.523859Z

Alright. I was interpreting https://shadow-cljs.github.io/docs/UsersGuide.html#compiler-options as relating exclusively to https://clojurescript.org/reference/compiler-options, but I see that's not really the case now.

thheller 2025-05-16T11:42:30.274779Z

yeah, it is mostly correct just not exclusively

👍 1