26 June 2021

Clojure: How to fix Parse error. primary expression expected case ##Inf:

I kept seeing this confusing error when trying to add ClojureScript to my existing project:

$ lein cljsbuild once
Compiling ClojureScript...
Compiling ["public/javascripts/main.js"] from ["src"]...
WARNING: imgor-js is a single segment namespace at line 1 src/imgor/core.cljs
Jun 26, 2021 4:06:45 PM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: /Users/edward/Projects/imgor/target/default/cljsbuild-compiler-0/cljs/core.js:3359: ERROR - Parse error. primary expression expected
case ##Inf:
      ^

Jun 26, 2021 4:06:45 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
ERROR: JSC_PARSE_ERROR. Parse error. primary expression expected at /Users/edward/Projects/imgor/target/default/cljsbuild-compiler-0/cljs/core.js line 3359 : 6
Successfully compiled ["public/javascripts/main.js"] in 6.335 seconds.

I was basing this on the the examples from the lein-cljsbuild repo itself, https://github.com/emezeske/lein-cljsbuild.

For me the fix was simple, just update to this version of clojurescript:

[org.clojure/clojurescript "1.10.866"]
Tags: clojure leningen clojurescript