Fork me on GitHub
Ertugrul Cetin07:06:56

@thheller regarding problem Illegal variable reference before declaration: i we talked about a few days ago. Someone suggested me to use different module type and I applied but getting another king of errors and does not work. Do you have anything to add here?


@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"]}


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..


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.


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


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.


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



{"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"}}

👍 2

I'll try that out.


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

hammock 3
Ertugrul Cetin07:06:25

@thheller @U09MR0T5Y 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


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!

👍 3

can't look into this more now, gotta go

Ertugrul Cetin07:06:34

yeah no problem, thanks!


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.


@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.


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


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


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


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


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?


npm install date-fns did the trick i think.