shadow-cljs

borkdude 2025-11-04T12:28:02.518989Z

is it possible to use a clojurescript version from master as a git dep with shadow? 🧵

borkdude 2025-11-04T12:28:15.907909Z

I'm seeing this with the latest master commit:

Note: The following stack trace applies to the reader or compiler, your code was not executed.
CompilerException Syntax error compiling new at (cljs/closure.clj:1977:13). #:clojure.error{:phase :compile-syntax-check, :line 1977, :column 13, :source "cljs/closure.clj", :symbol new}
	clojure.lang.Compiler.analyzeSeq (Compiler.java:7677)
	clojure.lang.Compiler.analyze (Compiler.java:7360)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:7657)
	clojure.lang.Compiler.analyze (Compiler.java:7360)
	clojure.lang.Compiler.access$200 (Compiler.java:43)
	clojure.lang.Compiler$LetExpr$Parser.parse (Compiler.java:6947)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:7669)
	clojure.lang.Compiler.analyze (Compiler.java:7360)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:7657)
	clojure.lang.Compiler.analyze (Compiler.java:7360)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:7657)
	clojure.lang.Compiler.analyze (Compiler.java:7360)
Caused by:
IllegalArgumentException No matching ctor found for class com.google.javascript.jscomp.DependencyOptions
	clojure.lang.Compiler$NewExpr.<init> (Compiler.java:3097)
	clojure.lang.Compiler$NewExpr$Parser.parse (Compiler.java:3174)
	clojure.lang.Compiler.analyzeSeq (Compiler.java:7669)
	clojure.lang.Compiler.analyze (Compiler.java:7360)
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.sun.jna.Native in an unnamed module (file:/Users/borkdude/.m2/repository/net/java/dev/jna/jna/5.16.0/jna-5.16.0.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

shadow-cljs - HTTP server available at 
shadow-cljs - server version: 3.2.1 running at 
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
------ ERROR -------------------------------------------------------------------
 File: /Users/borkdude/.gitlibs/libs/org.clojure/clojurescript/d912f929e4ca9b486a182575659dde95be20c386/src/main/cljs/cljs/repl.cljs
failed to require macro-ns "cljs.repl", it was required by "cljs.repl"
Error in phase :compile-syntax-check
Exception: namespace 'cljs.closure' not found

borkdude 2025-11-04T12:31:39.366769Z

Hmm, when using cljs.main directly:

$ clj -M -m cljs.main --target browser --output-dir public/js --compile my-app.core
Syntax error (IllegalArgumentException) compiling new at (cljs/closure.clj:1977:13).
No matching ctor found for class com.google.javascript.jscomp.DependencyOptions

borkdude 2025-11-04T12:33:26.702529Z

Adding com.google.javascript/closure-compiler-unshaded {:mvn/version "v20231112"} works (thanks ChatGPT...)

thheller 2025-11-06T08:21:35.003699Z

that is not a good fix, since that is a rather old closure compiler version lacking a lot of features such as the support for private fields

thheller 2025-11-06T08:21:56.770299Z

I suppose that should be fixed in CLJS itself, so it can use newer closure versions

thheller 2025-11-06T08:22:18.835049Z

closure keeps doing breaking API changes, so we always have to adjust slightly

borkdude 2025-11-06T08:45:33.908989Z

yeah eventually I looked up the closure from the pom.xml for clojurescript and added that

thheller 2025-11-06T10:26:38.009189Z

well still. it needs to be the one from shadow-cljs, otherwise its just older and lacking features

thheller 2025-11-06T10:27:11.817519Z

but yeah, if you don't care about that then it doesn't matter

borkdude 2025-11-06T10:29:06.689149Z

right, I was going back and forth between shadow and vanilla CLJS. Eventually I went with vanilla CLJS since I couldn't get lite mode working otherwise

borkdude 2025-11-06T10:29:12.486529Z

(I was just testing it)

thheller 2025-11-06T10:29:55.137359Z

it should be a trivial fix in cljs.closure. can't remember what the change was, but they are rarely complicated