Fork me on GitHub
#shadow-cljs
<
2020-09-28
>
g7s08:09:16

I don't know if this has been asked before but I am trying to require a json file in a react native project. Is it possible to do with shadow? If yes can someone please outline the process? thanks!

g7s08:09:37

Right now I have a "src/js/my/namespace/foo.json" file and I am including the "src/js" in my :source-paths I do not succeed when it comes to actually requiring the file

g7s08:09:27

One other thing I tried is to include a :js-options with :resolve to my json file to no avail

thheller08:09:09

@g7s you can only require json files via js/require to let metro fill it in

thheller08:09:24

(def data (js/require "../assets/foo.json"))

thheller08:09:47

path is relative to the created :output-dir

g7s09:09:46

ah I actually never tried that.. Thanks @thheller

shivekkhurana11:09:45

What's the status of code splitting with Reagent applications? I've found this 2 year old blog post by Thomas (https://code.thheller.com/blog/shadow-cljs/2019/03/03/code-splitting-clojurescript.html). It splits code but reactifies Reagent component before rendering. It it possible to lazy load Reagent components?

thheller11:09:29

thats what the post describes?

shivekkhurana11:09:18

In your post, the Reagent components are Reactified: https://github.com/thheller/code-splitting-clojurescript/blob/master/src/main/demo/util.cljs#L27 This means that Ratoms and Reframe cannot be used, since ratoms don't work with reactified components.

thheller12:09:47

thats not correct

thheller12:09:08

the wrapper loading the component is reactified. not the actual component

thheller12:09:25

the actual component can do whatever

shivekkhurana04:09:28

Thank you Thomas! I was able to get lazy loading work with shadow/lazy

shivekkhurana12:09:05

Oh, okay. I had a gap in my understanding.

shivekkhurana12:09:08

Will try it out.

Jakub Zika18:09:54

Hi, i ve been using shadow-cljs with lein to this day. Today i removed :lein true and moved all clojurescript deps into shadow-cljs.edn. When I run shadow-cljs watch app it fails with the required namespace devtools.preload is not available. But binaryage/devtools 1.0.2. Is one of my dependencies in shadow-cljs. edn. What is the problem? Should i go back to combination of lein and shadow-cljs even if it is discouraged fy shadow-cljs website?

thheller18:09:10

@jakub.zika-extern should be working fine. you sure you declared it correctly? no misplaced [] or so?

Jakub Zika18:09:27

No, but i am glad to hear that cljs dependencies should work 1:1 with lein. I moved everything back to lain but i will investigate further later for sure. Is there some debugging on shadow-cljs side like "show me installed dependencies" etc?

thheller19:09:27

shadow-cljs info shows a bit

Ian Fernandez20:09:19

I didn't found a way to run with node-tests to activate :auto-run true only on watch, there's a way to to this on shadow-cljs cli like shadow-cljs watch :my-test something-here ?

thheller20:09:57

shadow-cljs watch my-test --config-merge "{:autorun true}"