This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-10
Channels
- # beginners (35)
- # cider (165)
- # cljsrn (18)
- # clojars (1)
- # clojure (141)
- # clojure-greece (2)
- # clojure-italy (11)
- # clojure-nl (1)
- # clojure-spec (21)
- # clojure-uk (89)
- # clojurescript (56)
- # community-development (3)
- # cursive (3)
- # data-science (55)
- # datomic (13)
- # emacs (12)
- # fulcro (31)
- # graphql (6)
- # jobs-discuss (35)
- # lein-figwheel (10)
- # mount (2)
- # off-topic (3)
- # onyx (22)
- # parinfer (4)
- # portkey (7)
- # re-frame (29)
- # ring-swagger (4)
- # shadow-cljs (37)
- # specter (9)
- # sql (30)
- # tools-deps (15)
- # vim (2)
- # yada (17)
Hello All... Anyone seen this or something like it and able to give me any pointers on what to do about it - code builds on my local machine, but when I updated the repo on the remote machine to demo for my colleagues this happened when I tried to build my ClojureScript...
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: file:/home/ec2-user/.m2/repository/cljsjs/react/15.5.4-0/react-15.5.4-0.jar!/cljsjs/react/common/react.ext.js at (unknown source) line (unknown line) : (unknown column)
App built before - this seems to be because of adding recharts or leaflet (via cljsjs) into the dependencies for the app as that is the only real change apart from code that clearly parses / runs, in that my local machine has no trouble with it.
@maleghast This is Google Closure complaining
Yeah, I figured, but I don't understand why when the same code is compiling on my local machine
My honest confession is that my actual__ understanding of the tooling around the Java and Google Closure underpinnings of Clojure and ClojureScript is next to non existent.
Most of the time that is not a problem - I stick to well-trodden paths, popular libraries and I stick to as stable versions of things as I can find.
However... Sometimes I really cannot avoid but use something a little more obscure, and the problem is almost always a "works on my machine, not on the server" problem
i’m going to make a wild guess that react is being included twice because you added a cljsjs library that probably required a different version. does lein deps-tree (or whatever that command is) show any conflicts?
Here's where I make another admission - I'm using clojure.tools and it's my first outing without the leiningen or boot "safety-net"
I tried running the production build on my local machine and I get the same error, so I am going to assume that the "dev-mode" build is less strict and / or less optimised and that's why it's working
externs are provided twice, but you’re saying that advanced builds locally are working for you?
what @lee.justin.m suggested is the right thing to look at
OK, going to have to figure out how to do that without Lein / Boot... *goes off to Google*
@maleghast the other thing you can do is just add exclusions to the new cljsjs things you included. (I’m not sure how to do that with your setup because I use shadow-cljs, but somehow you should be able to exclude react
and react-dom
which should fix this problem if that’s what it is)
@lee.justin.m - Thanks that may well solve the issue, though in the same vein I am going to figure out how I do that in a deps.edn file, 'cos this is all new to me.
I am pretty sure that it's a dependency from recharts that is doubling up the externs, so I will start there.
@maleghast aren’t you using tools.deps?
@dnolen - Er, yes... I am building on top of the new verison of juxt/edge and it uses the new deps tools from 1.9 and has not Boot or Leiningen anywhere near it.
yeah, I am a bad Unix person; I find the docs one gets on the command line hard to follow / grok (gosh this thread is turning into a Geek Confessional)
OK, I think I have it... ReCharts uses cljsjs/react-with-addons 15.5.4-0 Reageant (0.7.0) uses cljsjs/react 15.5.4-0 They must be clashing with one another, right?
they have different lib names so both will be included
I see that, but I think that the former uses the same externs file as the latter, hence the error message that started all of this (^^) referring to "cljsjs/react/common/react.ext.js"
well you’re past my knowledge at that point :)
I think__ that I need to figure out how to exclude one of them so that the error goes away under advanced compilation.
My other thought is that a newer version of the ReCharts package on cljsjs might__ have different, more compatible deps... I am going to go and look at that too...
@maleghast just remove the react dep, react-with-addons is enough
(FWIW, updating the ReCharts dep does allow it all to build, but I am concerned that ReCharts latest version is based on React 16.x and that makes me nervous when my Reagent version is 0.7.0 so React 15.x)
I don’t think reagent 0.7.0 will work with react 16, but 0.8.0 has been released, so if you wanted to try to bump to react 16, you could try that. I suspect many react libraries will work even if you upgrade react out from under them. You definitely need to keep adding exclusions until you only include one version of react. Probably the most straightforward is to let reagent include what it needs and then exclude react from all of your libraries.
@lee.justin.m - Yeah, the problem is that the older version of ReCharts I was using relied on react-with-addons, so excluding that because it was not playing nice with react in advanced compilation would not work at all...
I am going to try bumping Reagent up to 0.8.0 as well and see if that works as that will take my core / foundational React up to 16.x and then as you say I can exclude react from anything that deps on 15.x on the basis that they should be able to get what they need from 16.x
i don’t know enough about the addons package to know if you can get recharts to work on react 16
you might actually have a better chance of letting recharts be the master of ceremonies and exclude react from everything else (including reagent)
i’m assuming here that cljsjs/react-with-addons
includes react. hard to tell without downloading and inspecting
this is where i make my obligatory nudge towards shadow-cljs which eliminates these woes
@lee.justin.m - Updating ReCharts and Reagent removes the issue and my app runs as expected. I think I will go with that; seeing as Reagent 0.8.0 is stable I should probably be building on it anyway. Thanks for the help, I think if things were not ok under Reagent 0.8.0 I would absolutely go the route you just described ^^ Also, thanks @dnolen for demystifying the deps tree stuff - I appreciate that a LOT.