shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
g7s 2020-09-28T08:46:16.080900Z

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!

g7s 2020-09-28T08:48:37.082600Z

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

g7s 2020-09-28T08:50:27.084Z

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

thheller 2020-09-28T08:59:09.084900Z

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

thheller 2020-09-28T08:59:24.085300Z

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

thheller 2020-09-28T08:59:47.085600Z

path is relative to the created :output-dir

g7s 2020-09-28T09:00:46.086500Z

ah I actually never tried that.. Thanks @thheller

shivekkhurana 2020-09-28T11:14:45.088500Z

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?

thheller 2020-09-28T11:15:29.088800Z

thats what the post describes?

shivekkhurana 2020-09-28T11:17:18.089700Z

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.

thheller 2020-09-28T12:00:47.090Z

thats not correct

thheller 2020-09-28T12:01:08.090400Z

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

thheller 2020-09-28T12:01:25.090900Z

the actual component can do whatever

shivekkhurana 2020-09-28T12:06:05.091500Z

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

shivekkhurana 2020-09-28T12:06:08.091800Z

Will try it out.

Jakub Zika 2020-09-28T18:13:54.097600Z

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?

thheller 2020-09-28T18:31:10.099900Z

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

Jakub Zika 2020-09-28T18:45:27.102900Z

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?

thheller 2020-09-28T19:12:27.103100Z

shadow-cljs info shows a bit

2020-09-28T20:18:19.104800Z

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 ?

thheller 2020-09-28T20:18:57.105200Z

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

2020-09-28T20:19:17.105700Z

thanks @thheller 🙂

2020-09-28T20:19:19.105900Z

=))