shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
ertugrulcetin 2021-06-17T07:20:56.139700Z

@thheller regarding problem Illegal variable reference before declaration: i we talked about a few days ago. Someone suggested me to use different module type https://github.com/pmndrs/three-stdlib/issues/69#issuecomment-862871876 and I applied but getting another king of errors and does not work. Do you have anything to add here?

thheller 2021-06-17T07:23:49.140600Z

@ertucetin yes, don't do the resolve config. When you want to default to using esm code then use :js-options {:entry-keys ["module" "browser" "main"]}

ertugrulcetin 2021-06-21T07:10:25.170400Z

@thheller @bbss thank you guys so much for the help! I found out how to make it work, I just used :js-options {:entry-keys ["module" "browser" "main"]} and added ["regenerator-runtime"] as a dep and everything works now https://github.com/ertugrulcetin/racing-game-cljs

2021-06-21T07:21:36.173300Z

Thanks for letting me know. I still think itโ€™s a bug on their side. But I donโ€™t have time to dig into it more myself so good to know this worked for you, will probably try it myself at some point. React three fiber and the other libraries are so cool!

1๐Ÿ‘
thheller 2021-06-17T07:24:04.141Z

can't look into this more now, gotta go

ertugrulcetin 2021-06-17T07:24:34.141300Z

yeah no problem, thanks!

dawdler 2021-06-17T11:17:53.145200Z

Is there any obvious reason why two simple (sh "cp" "-r" "from" "to") statements are not executed (it appears) when using shadow-cljs clj-run my.ns/build-fn? Other functions used in build-fn work as expected.

2021-06-17T12:46:40.145600Z

so I tried the entry-keys as my comment there suggests, but that gave me other problems for some other packages. That resolve config actually fixed all issues for me. I was wondering if entry-keys is a bit too general, might not you want to use esm for some but not for other libraries, probably misunderstanding how it works..

2021-06-17T12:48:06.146700Z

@ertucetin the error you have now seems related to three-mesh-bvh which I don't use, perhaps you could also add a resolve config for that library.

thheller 2021-06-17T12:48:18.147Z

@dawdler I susppose checking the return value :out and :err would tell you?

thheller 2021-06-17T12:49:37.147700Z

well it all depends on what kind of packages you use. if you are mostly using commonjs packages then the above wouldn't help much. if you have some kind of bad mix things get complicated.

thheller 2021-06-17T12:50:07.148200Z

in any case you should NEVER be using :target :file for npm packages

2021-06-17T12:50:31.148600Z

oh yeah, definitely on a mix of bad things! I'm happy I can keep it going with the more recent versions of these libaries.

2021-06-17T12:50:54.148800Z

oh, I'm not sure where I got that from..

thheller 2021-06-17T12:51:18.149Z

so

{"three-stdlib" {:target :npm :require "three-stdlib/index.js"}
 "@react-three/drei" {:target :npm :require "@react-three/drei/index.js"}
 "@react-three/fiber" {:target :npm :require "@react-three/fiber/dist/react-three-fiber.esm.js"}
 "@react-three/cannon" {:target :npm :require "@react-three/cannon/dist/index.js"}}

1๐Ÿ‘
dawdler 2021-06-17T12:52:01.149800Z

@thheller bah, thanks. worked in repl, which is why I was confused.

2021-06-17T12:52:43.150100Z

I'll try that out.

thheller 2021-06-17T13:09:51.150300Z

still haven't had time to look at this at all so I don't know why its necessary in the first place. really shouldn't be. maybe I can take a look tomorrow

1
sova-soars-the-sora 2021-06-17T18:27:18.151Z

Hi I want to use [cljsjs/date-fns "2.20.2-1"] in shadow-cljs... how can I include this dependency ?

sova-soars-the-sora 2021-06-17T18:27:43.151500Z

well my end-goal need is a lib i can use to make a calendar app. if that helps / short circuits this need

sova-soars-the-sora 2021-06-17T18:32:45.152300Z

If a library exists in NPM such as "date-fns" do I still need to include it in the :dependencies [[]] key in shadow-cljs.edn?

sova-soars-the-sora 2021-06-17T18:36:56.152600Z

npm install date-fns did the trick i think.

rberger 2021-06-17T21:44:35.152700Z

I have a little playground example for getting cljs working with lambda. I think it still works https://github.com/omnyway-labs/lambda-play

rberger 2021-06-17T21:49:01.152900Z

This also looks interesting. Not (yet) supporting cljs but it makes it easy to use Java, GraalVM or Babashka for lambdas https://github.com/FieryCod/holy-lambda The biggest issue I found with using cljs in lambdas (or probably any standalone node style program) is you are trapped in single thread / Promise / Async hell that you don't really experience in a browser / reagent / re-frame app