Fork me on GitHub
#shadow-cljs
<
2021-06-17
>
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 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?

thheller07:06:49

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

bbss12:06:40

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

thheller12:06:37

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.

thheller12:06:07

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

bbss12:06:31

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.

bbss12:06:54

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

thheller12:06:18

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

👍 2
bbss12:06:43

I'll try that out.

thheller13:06:51

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 https://github.com/ertugrulcetin/racing-game-cljs

bbss07:06:36

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
thheller07:06:04

can't look into this more now, gotta go

Ertugrul Cetin07:06:34

yeah no problem, thanks!

dawdler11:06:53

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.

bbss12:06:06

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

thheller12:06:18

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

dawdler12:06:01

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

sova-soars-the-sora18:06:18

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

sova-soars-the-sora18:06:43

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-sora18:06:45

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-sora18:06:56

npm install date-fns did the trick i think.