Fork me on GitHub
#shadow-cljs
<
2021-08-30
>
danielneal08:08:08

heya has anyone been using shadow/expo/react native recently?

danielneal08:08:17

I’ve been away from the area for a couple years

danielneal08:08:30

and just going back to it for a hobby project

danielneal08:08:57

everything has moved on a bit and the new client doesn’t have the same ‘hot reload/fast reload’ it now has ‘fast refresh’

danielneal08:08:41

I want to disable all that so can rely on shadows reloading, but I don’t seem to be able to switch off the reloading…I keep getting an error every time it reloads saying DevMenu not found

danielneal08:08:52

I’m curious if anyone has any updates or tips since 2019

borkdude08:08:54

@danieleneal fwiw since 2019 there's also krell, a tool that David Nolen built

borkdude08:08:56

there's also a #cljsrn channel about React native

danielneal09:08:35

ah yeah I did see the announcement but don’t know anything about krell. I guess that is separate from expo. I really like the expo client and convenience for sharing and building the project but maybe Krell is better

Uken709:08:06

@danieleneal Hi, I have been working with that stack, I'm pretty new on it, but I'm doing a hobby project with it. I found a repo that could help you: https://github.com/PEZ/rn-rf-shadow If you look at the commit history you'll find a commit that disables webpack's fast refresh. They say that it let's shadow's hot reload do all the work. I tried to do that and had no luck, it disabled both refreshes

danielneal09:08:13

ah yeah interesting. Thanks @u.sk8

danielneal09:08:29

I think that commit is about disabling it for the web app rather than the rn app

danielneal09:08:54

but it does say maybe enabling and then disabling fast refresh might work

danielneal09:08:57

I’ll try that

Uken709:08:53

I dont have problems to disable fast refresh in my rn app. I just shake my phone (or emulator) and disable from the dev menu. Maybe you need to update the libraries or put compatible versions. If you clone that repo it should work. The only problem I have with it is Expo warning me about a file that ends with .expo.js that Shadow (I think) produces and it will be no longer compatible with future expo versions.

danielneal09:08:08

yeah I get that error, but also every time a reload happens I get some error about DevMenu.

danielneal09:08:21

I’m on the latest version of expo and shadow, so possibly something changed

danielneal09:08:29

I remember the ecosystem can be quite fragile

Uken709:08:02

As I said, I'm pretty newbie, so I would do the following: • Look at the versions of your npm libs and ensure are the same as the project from PEZ • Delete node_modules and any other output folder • npm i • Start shadow and then start expo I have noticed that not necessarily ultimate versions are the best, in fact, I found that using the lastest expo version didn't compile my project, so I used the PEZ' version. Also, deleting every output folder have solved me problems when I was updating my libs. Hope you can solve your problem :)

alexdavis09:08:07

The .expo.js error can be solved with an env var like this https://github.com/armincerf/kalm-mobile/blob/master/package.json though really I think that file should be renamed in shadow There is also a bug with expo where starting the expo go app with fast refresh disabled won't actually fully disable it, so you have to enable and disable it again for it to actually disable

😃 1
Simon14:08:46

Hey, how do i consume environment variables? I have defined one like this:

{:builds
 {:app {:asset-path "/js"
        :modules {:main {:init-fn app.core/main}}
        :output-dir "public/js"
        :target :browser
        :closure-defines {app.helpers.analytics/Greeting #shadow/env "HEY Simon"}
        :js-options {:ignore-asset-requires true}}
But then how do i get it so that i can do this:
(prn Greeting)

Simon15:08:29

Following this i need to use (goog-define variable-name "default value") But it only provides the default value and doesn't get overwritten

Simon15:08:11

It works with shadow-cljs release app -config-merge '{:closure-defines {app.envvars.core/APP_ENV :dev}}'

thheller17:08:23

app.helpers.analytics/Greeting would be (goog-define Greeting ...) in (ns app.helpers.analytics) somewhere. should be fine.

Simon14:08:07

Yes thank you. Would be great with this example in the Shadow-cljs User Guide

andrzejsliwa14:08:29

Hey can you recommend any good template or blueprint for configuring pedestal together with shadow-cljs, I mean something which will handle full stack (clj, cljs, cljc)?

thheller17:08:45

pedestal doesn't care about shadow-cljs and shadow-cljs doesn't care about pedestal

thheller17:08:02

pretty much the only config you need to have in pedestal is that it serves the static .js files generated by shadow-cljs

thheller17:08:52

can't remember what that setting was. something ::http/file-root or so ::http/resource-root or so

hadils17:08:23

Which closure complier should I be using with shadow-cljs 2.15.6?

thheller17:08:47

com.google.javascript/closure-compiler-unshaded v20210505