Fork me on GitHub
#shadow-cljs
<
2018-11-05
>
teawaterwire15:11:33

hi, I'm having troubles understanding the meaning of "cljsjs packages are not supported" (https://shadow-cljs.github.io/docs/UsersGuide.html#cljsjs) — for instance, to use re-frame-10x, as it is mentioned here (https://github.com/Day8/re-frame-10x/blob/master/docs/Advanced-Setup.md#using-shadow-cljs) I just need to npm install some packages, but I will have some global variables exported (ie js/FlipMove), which means that somehow these lines are still taken into account? https://github.com/cljsjs/packages/blob/ade50f320730c9f144382a519414e09c8ba73fe5/react-flip-move/build.boot#L33-L36

wilkerlucio16:11:22

@U5UCAE37Z its not, the reason it works is because of shadow-cljsjs

wilkerlucio16:11:43

this contains some pre-packaged ways to load things to look like they come from cljsjs, but they dont

wilkerlucio16:11:54

if the library you want to use is not there, you will need to export the symbols yourself

teawaterwire17:11:37

oh I see it is already in the package shadow-cljsjs ? because I thought I had to add it manually, but ok that would make sense... Thanks!! I was confused 🙂

wilkerlucio17:11:31

no worries, the shadow-cljsjs comes built-in with shadow, so new stuff might need new versions, but its usually updated

👍 4
teawaterwire17:11:10

shadow never ceases to amaze me!

kanwei16:11:39

upgraded to Clojurescript 1.10.439 and now getting compile errors: https://gist.github.com/kanwei/6d7e68bb26074b1c6a7e5036c3bc157f

kanwei16:11:10

went back to 1.10.339 and it builds again

kanwei17:11:31

there also seems to be a caching issue: i use inferno-compat instead of react, and upgraded all the dependencies in package.json, and ran npm-install. running shadow-cljs only upgraded inferno-compat, and doing console.log(inferno) still showed old version. i removed the entire .shadow-cljs folder and it built with the updated inferno.

ClashTheBunny18:11:25

I already mentioned that issue and there is a solution on master, I believe.

hlolli18:11:18

out of curiosity, what does this warning mean

63 |                        (when (exists? event.target.files)
------------------------------------^-------------------------------------------
 js/event is shadowed by a local

thheller19:11:53

@hlolli (let [event ...] ...)? exists? assumes to only check global variables

hlolli10:11:38

ah, I took it for typef x.y.z !=== 'undefined' but it's trivial to do this logic differently... (or not do it at all since it should always exist in input type="file") thanks!

thheller19:11:44

@kanwei 1.10.439 is not currently supported. I'm hesistant to push the update to make it compatible because it has a pretty annoying externs inference regressen https://github.com/thheller/shadow-cljs/issues/401

kanwei19:11:50

any idea on the caching issue?

kanwei19:11:05

it's weird that inferno-compat upgraded but inferno stayed old

thheller19:11:16

@kanwei the cache issue I don't know. did you have the watch running while npm install was doing its thing?

thheller19:11:37

something it seems to confuse the watch since npm modifies so many files

kanwei19:11:41

can't remember, possible

kanwei19:11:53

but wouldn't a fresh run check for staleness?

kanwei19:11:00

i definitely restarted it after install

thheller19:11:10

ah ok yes that definitely rechecks

kanwei19:11:19

yeah, it still had old inferno

kanwei19:11:48

i don't care per-se now that it works, but i figured it might happen to someone else

thheller19:11:14

just to recap you had an old version of inferno-compat and just installed a new version over it but shadow-cljs didn't pick it up?

thheller19:11:39

that should be easy enough to reproduce. I'll try tomorrow

kanwei20:11:35

i had old versions of 5 libraries:

"inferno": "^6.1.4",
    "inferno-clone-vnode": "^6.1.4",
    "inferno-compat": "^6.1.4",
    "inferno-create-class": "^6.1.4",
    "inferno-create-element": "^6.1.4",

kanwei20:11:42

(this is the updated versions)

kanwei20:11:47

the old ones were 5.6.1

kanwei20:11:11

when i upgraded today, all of them to 6.1.4, inferno-compat updated but inferno stayed at 5.6.1

kanwei20:11:31

i had to go into the generated code and console.log(inferno) to verify

thheller20:11:49

are you sure that node_modules/inferno-compat actually had the new version?

kanwei20:11:08

pretty sure, yes

thheller20:11:10

maybe it was installed nested somewhere

kanwei20:11:24

well, the app broke, so if inferno-compat stayed old, it would not have broken

kanwei20:11:43

was giving inferno.render was not found

thheller20:11:55

I assume you have some :resolve settings?

thheller20:11:05

to switch out react?

kanwei20:11:45

:js-options       {:resolve {"moment"             false
                                                             "react"              {:target :npm :require "inferno-compat"}
                                                             "react-dom"          {:target :npm :require "inferno-compat"}
                                                             "create-react-class" {:target :npm :require "inferno-reagent-compat"}
                                                             "jquery"             {:target :global
                                                                                   :global "jQuery"}}}

Logan Powell20:11:47

👋 Hi fellows, I'm trying to do some challenging js<->cljs interop with a js library that internally uses promises to call functions that the user supplies (which seem to need to be pre-compiled into javascript for it to work). I'm rummaging around the shadow docs and trying to work out how to configure some test code, compile it to js then re-include it as a require

Logan Powell20:11:08

I can't seem to resolve / require the local file that I've compiled...

Logan Powell20:11:31

The required JS dependency "../../dist/test.js" is not available, it was required by "workers/core.cljs".

Logan Powell20:11:34

This is the first time I'm actually trying to compile with shadow-cljs... I've been working solely in dev mode (@ 5-months) so far