Fork me on GitHub
Jo Øivind Gjernes09:07:12

I can't seem to get my cytoscape.js import to work. Ending up with this:

Uncaught TypeError: module$node_modules$cytoscape$dist$cytoscape_esm.cytoscape is not a function
    at Object.topology$graph$cytoscape_clj [as cytoscape_clj] (graph.cljs:36)


@jodleif no clue what cytoscape is but I'm guessing you used it wrong. check the translation table and section about default exports here:

Jo Øivind Gjernes14:07:59

0. ( visualization library) 1. I've verified that the function it is complaining about exists in the js source shadow-cljs is pointing to 2. I've also verified other npm packages work :man-shrugging: (i.e. calling imported function, getting something back in repl) 3. What's the next step in debugging this? The import seems to work but i'm obviously missing something...


did you read the docs? II'm almost 100% sure that your :require is just wrong


pretty sure thats the only thing you need to debug

Jo Øivind Gjernes14:07:07

I've read docs and some blog posts you have written


I really can't help you without seeing code. I can only guess what you are doing. From the error message I'm guessing you used :refer (cytoscape) when either :as cytoscape or :default cytoscape would be correct.


so (:require ["/js/cytoscape.esm.min" :default cytoscape])


(cytoscape (clj->js {}))


why /js/cytoscape.esm.min? why not use the npm package? or is that not an npm package?

Jo Øivind Gjernes15:07:43

Just hammer debugging. :default seems promising, I've tried that as well- but maybe repl had dirty state Now:

(cytoscape (clj->js {}))
#object[eo$$module$js$cytoscape_esm_min [object Object]]


I see that the was updated, but the readme is a bit confusing, would it be all right if I suggest further changes in a PR? E.g. why use both yarn and npm? then how to go twice into the same directory? cd react-native appears twice.


the rn commands you run in the react-native dir so you need to cd into it


happy about a PR to adds more docs if that makes it clearer


so, i tried it and it works, i just feel that what i learned is too empirical, don't understand why it works the way it works. not the shadow-cljs part, that's transparent at least, but now I am guessing the yarn install is there so that --legacy-peer-deps is avoided for npm, and I rather use the web interface, but otherwise the watch keeps the terminal, so I see why it's mentioned twice


i also have to run adb devices first for the react native run command to work, this something that start to look like religious rituals : )


can't comment on any react-native parts and would recommend following their docs


I got it running once when I setup that example. I have not launched it since and probably won't for a while 😛


do you publish to mobile some other way or not very much?


just regular web stuff