shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
kiranshila 2021-06-06T16:29:45.396600Z

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.

thheller 2021-06-06T16:31:23.397Z

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

kiranshila 2021-06-06T16:33:05.397600Z

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

kiranshila 2021-06-06T16:33:12.397900Z

https://clojars.org/com.kiranshila/cybermonday

thheller 2021-06-06T16:33:17.398100Z

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

πŸ‘ 1
kiranshila 2021-06-06T16:33:45.398700Z

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

thheller 2021-06-06T16:34:00.399100Z

into the root of one of your source paths

thheller 2021-06-06T16:34:23.399300Z

so src/deps.cljs in your case

kiranshila 2021-06-06T16:35:28.399600Z

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

kiranshila 2021-06-06T16:40:46.400Z

Success! Thank you @thheller!

πŸ‘ 1
sb 2021-06-06T17:39:48.401400Z

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.

sb 2021-06-06T17:41:07.401800Z

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

thheller 2021-06-06T17:41:33.402100Z

read and understand the translation table here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

πŸ‘ 1
thheller 2021-06-06T17:41:48.402300Z

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

βœ… 1
thheller 2021-06-06T17:41:52.402500Z

and you'll find the problem

sb 2021-06-06T17:42:05.402700Z

thanks!!

thheller 2021-06-06T17:45:42.403100Z

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

πŸ‘ 1
thheller 2021-06-06T17:46:11.403300Z

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

πŸ‘ 1
sb 2021-06-06T18:06:28.403700Z

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

πŸ‘ 1