Fork me on GitHub
#cljsrn
<
2017-09-17
>
raspasov01:09:43

holy smokes… has anyone run into this or a variation of? https://github.com/facebook/react-native/issues/15195

raspasov01:09:58

I just started happening seemingly from nowhere …

raspasov01:09:47

can’t do a production build at the moment, veeeeery annoying…

raspasov01:09:19

also: on a related note - has there been any discussion that I have missed re: GETTING RID OF packager/metro-bundler/whatever

raspasov01:09:49

I saw some people talking about it, but lost the thread

raspasov01:09:29

I’m literally willing to put a few weeks of work myself to get this done… those things are beyond frustrating to use

jeaye21:09:40

I've just tried this, but I end up getting an error while running the bundler. Unable to resolve module react-navigation` from /home/jeaye/projects/lets-bet/client/index.android.js: Module does not exist in the module map or in these directories:`

jeaye21:09:26

So, it looks like something is still looking in index.android.js, even though I've changed my project.clj to compile to cljs.android.js.

jeaye22:09:14

Ah, looks like it's gradle. There are more changes needed in build.gradle, for Android.

jeaye22:09:05

Ok, after that, I see this: TransformError: /home/jeaye/projects/lets-bet/client/cljs.android.js: Cannot read property 'tokens' of undefined

raspasov10:09:54

finally able to complete a production build in under 1-2 minutes! in 1+ year of React Native this is a first

raspasov10:09:06

figured out how to exclude the Google Closure output from the evil hands of metro-bundler/Babel 😂

raspasov10:09:44

there should be a Nobel prize in Babel hacking

jeaye19:09:55

Does RN affect ClojureScript's :preloads at all? I haven't been to preload anything, unfortunately.

jeaye19:09:29

I have a simple ns with (ns me.dev) (.log js/console "something")) and I've :preloads [me.dev] in my leiningen project, in the cljsbuild :compiler map. I see nothin'.

jeaye22:09:10

@raspasov That looks awesome; I'll give it a shot this week. Thanks so much for digging deeper into metro for it.

raspasov23:09:41

@jeaye I haven’t used :preloads myself - I’m reading the docs https://clojurescript.org/reference/compiler-options - is that something only for development? all my findings are mostly for production build (in RN there’s a difference between dev and production and you MUST compile for production otherwise your app is many times slower); luckily, I haven’t had many problems for dev builds with React Native, they have mostly worked, or at least much more so than when trying to get metro/babel to go through a few MB one file output under Google Closure :advanced (or even :simple - that might be even harder but I haven’t been using :simple or other Closure options in a while)

jeaye23:09:24

Yeah, the :preloads issue is entirely separate from the Babel builds and all of that other nonsense.

jeaye23:09:45

I brought it up a few hours ago and only now just read about your progress on the Babel issue.

jeaye23:09:45

:preloads is something that's only used in development and I'm looking to use it to help me trace events as they flow through re-frame. It uses preloads to hook some functions, but the preloading isn't working at all. When I've tried with a simple test ns, it also didn't work, so it might be something RN related.

raspasov23:09:52

right — so if it gets included in your final :advanced output such index.ios.js (or better my-unique-name.ios.js like I wrote for Babel-related reasons) it should not affect anything

jeaye23:09:08

I'm not making an :advanced build.

jeaye23:09:59

We have :advanced builds, for production, but :preloads applies specifically to dev builds.

raspasov23:09:06

are you doing a RN production or dev build?

raspasov23:09:36

I see… so what does preloads do for you under dev?

jeaye23:09:56

Everything I'm doing with :preloads is with a dev build. It does nothing; the preloaded namespaces are never executed.

jeaye23:09:36

As I mentioned in my example above, I put a log to the JS console and it doesn't show up anywhere in logcat or the dev tools console.

raspasov23:09:13

I have gotten my logs to show up in my Cursive/IntelliJ REPL

raspasov23:09:20

via figwheel

jeaye23:09:28

You're missing my point.

raspasov23:09:29

and I can REPL into the device also…

raspasov23:09:37

sorry 🙂 please explain

jeaye23:09:43

My app works fine, in both debug and production. My logs work fine. I'm not talking about Babel or production builds. I'm just talking about :preloads and CLJS and RN, as the combination itself doesn't appear to work.

jeaye23:09:33

I apologize for any confusion.

raspasov23:09:53

got it… ok… I haven’t used those so I can’t comment then 🙂 wonder how :preloads really works, like how does it tell the browser/environment/etc to “preload” them

jeaye23:09:18

It tells the Closure compiler to execute those namespaces before loading cljs.core.

jeaye23:09:51

That's it, I think.

raspasov23:09:59

oh ok… before clojurescript core or before your own “main” fn?

raspasov23:09:17

like if it’s before ClojureScript core… how is anything working? 🙂

jeaye23:09:19

Before ClojureScript's core, and long before main.

raspasov23:09:29

oh wow… so like just … javascript?

jeaye23:09:54

Well, CLJS compiled to JS, yeah. So (.log js/console "meow") will be there, since you're in JS.

jeaye23:09:01

But you won't have println or map or anything.

raspasov23:09:03

probably my understanding of how Google Closure/ClojureScript works is limited in this scenario 🙂

raspasov23:09:19

ah I see.. so ClojureScript works

jeaye23:09:26

Yeah, just not cljs.core.

raspasov23:09:29

but no clojurescript core functions!

raspasov23:09:35

haha that’s funky

raspasov23:09:38

I like it haha

raspasov23:09:24

wonder if the output of :preloads is a separate file?

raspasov23:09:36

if that’s not sent to the device somehow, then it won’t work, since that’s the work of packager etc… but it should not be a fundamental RN limitation it sounds… I would look into how re-natal constructs the dev build file structure

jeaye23:09:37

Yep, I suspect it's something along those lines.