Fork me on GitHub
#shadow-cljs
<
2021-06-06
>
kiranshila16:06:45

Quick question - what is the "correct" way to package up a library with node dependencies? I've tried adding the list of them to deps.cljs in src, but including the dependency from clojars in a shadow project elsewhere didn't seem to install them.

thheller16:06:23

how did you package it? I mean is the deps.cljs file actually included with the jar? what is the clojars lib?

kiranshila16:06:05

Ooo it doesn't look like it is in the jar

thheller16:06:17

deps.cljs with {:npm-deps {"foo" "version"}} is the correct way

πŸ‘ 3
kiranshila16:06:45

And does it go in the root of the project or next to the source, I wasn't quite sure

thheller16:06:00

into the root of one of your source paths

thheller16:06:23

so src/deps.cljs in your case

kiranshila16:06:28

Ah I see, I think I put it too deep the first time I tried

kiranshila16:06:46

Success! Thank you @thheller!

πŸ‘ 3
sb17:06:48

Could somebody help to test this repo? https://github.com/damesek/example-error I created from this, and still not work on my computer, but there is a screenshot too that is works. From here: https://stackoverflow.com/questions/58852849/clojurescript-date-timepicker-with-cljsjs-react-day-picker. I got this react.development.js:316 Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

sb17:06:07

I think, that is a same issue at all packages.. as I feel. I can’t find out, maybe very trivial.. πŸ˜•

thheller17:06:48

then compare the JS code from the example docs with the CLJS code you have

βœ… 3
thheller17:06:52

and you'll find the problem

sb17:06:05

thanks!!

thheller17:06:42

note that looking at "old" example may not be correct today

πŸ‘ 3
thheller17:06:11

JS packages often change how they bundle stuff so the way you require them may change as well

πŸ‘ 3
sb18:06:28

Ok, … now works all. :man-facepalming:picard-facepalm thanks the help!

πŸ‘ 3