This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-19
Channels
- # announcements (52)
- # asami (83)
- # atom-editor (1)
- # babashka (143)
- # beginners (123)
- # calva (18)
- # chlorine-clover (21)
- # cider (7)
- # clj-kondo (57)
- # cljs-dev (4)
- # clojure (209)
- # clojure-boston (1)
- # clojure-europe (27)
- # clojure-germany (12)
- # clojure-italy (17)
- # clojure-nl (3)
- # clojure-serbia (6)
- # clojure-spec (1)
- # clojure-uk (59)
- # clojurescript (82)
- # conjure (9)
- # core-async (6)
- # cursive (20)
- # data-science (1)
- # datahike (1)
- # datascript (1)
- # datomic (86)
- # duct (5)
- # emacs (6)
- # events (6)
- # figwheel-main (4)
- # fulcro (27)
- # graalvm (19)
- # leiningen (14)
- # lsp (30)
- # malli (48)
- # meander (3)
- # off-topic (6)
- # pedestal (2)
- # practicalli (1)
- # rewrite-clj (21)
- # shadow-cljs (18)
- # sql (15)
- # tools-deps (9)
- # vim (3)
- # wasm (3)
- # xtdb (18)
I have a fullstack CLJ/CLJS app and I try to compile a production bundle from the CLJS part. I’m running alias clj -M:build-fig-prd
where
:build-fig-prd {:main-opts ["-m" "figwheel.main" "-O" "advanced" "-bo" "prd"]
:extra-deps {com.bhauman/figwheel-main {:mvn/version "0.2.12"}}}
It seems that one of my Java dependencies (used in server side) in deps.edn somehow doesn’t work with the advanced compilation since it fails with:
[Figwheel] Compiling build prd to "dist/main_bundle.js"
[Figwheel] Failed to compile build prd in 4.339 seconds.
[Figwheel:WARNING] Compile Exception: com.google.common.collect.Streams
[Figwheel:SEVERE] com/google/common/collect/Streams
Execution error (ClassNotFoundException) at jdk.internal.loader.BuiltinClassLoader/loadClass (BuiltinClassLoader.java:606).
com.google.common.collect.Streams
If I comment out my Java dependency google-cloud-texttospeech
the build succeeds.
:deps {org.clojure/clojure {:mvn/version "1.10.2"}
org.clojure/clojurescript {:mvn/version "1.10.773"}
...
com.google.cloud/google-cloud-texttospeech {:mvn/version "1.3.0"}
I’m wondering do I need to change my project setup somehow to prevent my server side dependencies to create problems on frontend build or is there something else I can do here?A very late reply, so you probably already came up with a solution, but that looks like a Guava dependency conflict. ClojureScript depends on Guava, and, presumably, so does google-cloud-texttospeech. Perhaps setting an explicit dependency on the Guava version that ClojureScript requires would fix the issue. If you're unlucky, that might break google-cloud-texttospeech, of course, in which case... :man-shrugging::skin-tone-2:
Generally, though, it's better to have ClojureScript-only dependencies in a separate profile (e.g. :dev
) so that they don't end up in the uberjar you're possibly making. After all, you likely only need the compiled JavaScript artifact in there.
Thanks Eero for replying. I also finally figured out that it is better to have separate profiles for the front end and backend codes. Good point that I should also separate the dev deps on front end side so only the compiled JS artifact would go to the uberjar 👍:skin-tone-2: