Search code examples
clojureversioningdependency-managementclojurescriptshadow-cljs

How does shadow-cljs handle duplicates of the same dependency with difference versions on the shadow-cljs.edn file?


I have been using Clojure, ClojureScript, lein, shadow-cljs, re-frame, reagent, Emacs, and CIDER to work on a Clojure/ClojureScript dynamic web app project.

In my shadow-cljs.edn, I have:


{:source-paths ["src" "dev"]

 :dependencies [[testdouble/clojurescript.csv "0.5.2-LOCAL-FORK"]
                [testdouble/clojurescript.csv "0.5.1"]]
                
                .
                .
                .

As you see, there is a duplicate of the same dependency being used two times.

How does shadow-cljs treat this?

Are both dependencies compiled? One over the other?

Just the latest one or the last one to be displayed on the file?


Solution

  • A library can only be added once, due to how the classpath works. In case of :dependencies in shadow-cljs.edn it'll pick the first one found.

    But really you shouldn't ever use two versions of the same lib. It may have unexpected results and should be avoided. In fact I'm a little surprised that doesn't already throw an error.