1
votes

I am making a project which relies on Reagent, aswell as on ReactTransitionGroups. After I included ReactTransitionGroups I had to include react-dom for some reason. But after that I can't make my uberjar because of anduplicate externs error.

 :dependencies [[org.clojure/clojure "1.8.0"]

              [reagent "0.6.0" :exclusions [cljsjs/react]]
              [cljsjs/react-with-addons "15.4.2-2"]
              [cljsjs/react-dom "15.4.2-2"]
              ]    

Here are my cljs settings aswell

:cljsbuild
  {:builds {:min
        {:source-paths ["src/cljs" "src/cljc" "env/prod/cljs"]
         :compiler
         {:output-to "target/cljsbuild/public/js/app.js"
          :output-dir "target/uberjar"
          :optimizations :simple
          :pretty-print  false}}
        :app
        {:source-paths ["src/cljs" "src/cljc" "env/dev/cljs"]
         :compiler
         {:main "ironrainbow.dev"
          :asset-path "/js/out"
          :output-to "target/cljsbuild/public/js/app.js"
          :output-dir "target/cljsbuild/public/js/out"
          :source-map true
          :optimizations :none
          :pretty-print  true}}}}

And my error code when trying to lein uberjar

SEVERE: ERROR - Duplicate extern input: file:/C:/Users/Paul/.m2/repository/cljsjs/react/15.4.2-2/react-15.4.2-2.jar!/cljsjs/react/common/react.ext.js

WARNING: 1 error(s), 0 warning(s) ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: file:/C:/Users/Paul/.m2/repository/cljsjs/react/15.4.2-2/react-15.4.2-2.jar!/cljsjs/react/common/react.ext.js at (unknown source) line (un known line) : (unknown column)

1
Is not it supposed to be: [reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]] instead of just [reagent "0.6.0" :exclusions [cljsjs/react]]? - akond
My answer was too long, so the shorter version is: if I use [reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]] then I get missing dom-server. So I imported [cljsjs/react-dom-server "15.4.2-2"] too, but then I got the duplicate error again. - Paul Cristian Martin
Ok, you opened my eyes to how this really works. So I played a little bit with the dependencies. The answer is [cljsjs/react-with-addons "15.4.2-2"] [cljsjs/react-dom "15.4.2-2" :exclusions [cljsjs/react]] [cljsjs/react-dom-server "15.4.2-2" :exclusions [cljsjs/react]] You really helped me, so if you take the trouble of making an answer then I will accept it. Thanks again. - Paul Cristian Martin

1 Answers

1
votes

Some packages contain other packages and sometimes those packages are duplicated. You have to exclude all the duplicates like so:

[cljsjs/react-with-addons "15.4.2-2"] 
[cljsjs/react-dom "15.4.2-2" :exclusions [cljsjs/react]] 
[cljsjs/react-dom-server "15.4.2-2" :exclusions [cljsjs/react]]

To see the whole dependency tree, run: lein deps :tree